-
Notifications
You must be signed in to change notification settings - Fork 25
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
Incorrect usage of @cImport
#39
Comments
Hello @tauoverpi ! First of all, thank you for your comment! Thank you for mentioning the proposal. I was not aware of it. Now, when you say:
I don't understand why this is a problem, could elaborate more? Or point to some part of the official Zig docs that clarifies your point? |
The main issue is that separate modules end up being generated thus zig sees them as distinct as zig doesn't use structural types outside of tuples. This means that if you have functions from import There is a ticket on this but I need to spend more time to search for it another time. |
Uhmm I see. Thank you very much for the explanation! This needs to be fixed on the book then. I also made a quick search earlier through the open issues in the zig GitHub Repo, but I was unable to find the issue that cited this problem. Thank you anyway 😉 |
The following promotes an incorrect use of
@cImport
as it runstranslate-c
twice (once for each call) and results in two separate modules where all composite types do not compare equal as zig doesn't use structural equality. There should only be a single use of@cImport
within the project to avoid such conflicts.zig-book/Chapters/14-zig-c-interop.qmd
Lines 98 to 104 in d9bf342
Do also note that
@cImport
will be removed in favour of ziglang/zig#20630The text was updated successfully, but these errors were encountered: