-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{.emit.} for types is too late: Nim uses them before their declaration #16664
Comments
Isn't there a special |
See this for an example in the testsuite: Nim/tests/statictypes/tstaticimportcpp.nim Lines 6 to 23 in 662c508
|
Indeed, apparently it hooks there https://github.com/nim-lang/Nim/blob/acf3715/compiler/ccgstmts.nim#L1489-L1495 Is there a plan to document that or maybe have specialised |
It is already documented https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-emit-pragma |
see also #13953 |
I'm trying to wrap a C++ library and I need to resort to {.emit.} to workaround the absence of default field value for Nim and the C++ backend (#4687)
Unfortunately Nim generates types before they were emitted.
Test case:
The code generated (with danger) is:
Note that if you remove the importcpp (in the same code), a forward declaration section appears
NIM_merge_FORWARD_TYPES
Is there a way to notify importcpp that a type is defined in the same module and so need forward declaration?
The text was updated successfully, but these errors were encountered: