-
-
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
[Regression] Missing type declarations in C code if members are used in {.emit.} #7363
Comments
Hi Yuriy, |
I have a patch, I will prepare PR later today |
I think this may be related to that issue. Seems that ptr or var reference to structure type doesn't cause generation of C code for that type. For example:
However adding next line:
causes code to be generated |
Hi Zdreni, |
Zdreni, maybe you have more comprehensive example |
The talk is probably about ttf lib which is exactly the reason why I filed this issue. |
Sorry, example was fixed. This was a bit shortened extraction of code from ttf (0.2.4) nimble package. |
After fix, the issue still remains in other form. Just use additional level of indirection:
Causes: |
I also need to mention that simple tracking of field names mentioned in emit possibly may not help in corner cases where name of field is generated by macro/concatenating two strings. TBH, I doubt there is a reason for optimizing out structures, that may be possibly used in emit blocks. |
checking... |
I suggest I'll add support for expression backticking in emit pragma:
and also
It is useful feature on its own plus it will allow Nim to trace type usage properly. Let me know if you are ok with the proposal. |
@cooldome, I'm ok with your proposal, although I think |
Proposed solution with expression backticking, however, will not work on lot of existing code, leaving packages broken. And yes, I agree with @yglukhov. I see no harm in generating |
Yuriy, |
I have submittted the PR with backticking of expressions |
Seems like this issue was closed by irrelevant PR. Also note, that this can be easily worked around by adding
to the |
I have raised separate feature request #7448 |
Too much of a fringe case. |
Introduced in 70b28a3.
@cooldome, can we fix it so that
{.exportc.}
types are always declared completely?The text was updated successfully, but these errors were encountered: