-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Feature request: libc header import without libc library import #7687
Comments
|
Yeah, it gets tricky (but not impossible) if you want cross-compilation to be possible. |
As a workaround, use musl. |
Appaerntly, if you don't link to libc, but just have some Here's my "C" library with a header file which doesn't really depend on libc at runtime:
Here's the Zig code which imports the header
If I just try to compile it, I get the error I expect to get given this issue:
That is: no cImport if you don't link libc! But, if I add
Notably, not only Zig is able to find my
So it looks like this might have been mostly fixed as of Zig 0.13, and only the error message needs to be adjusted: it's not about EDIT: further investigation shows that |
Expected to be solved by #20630 |
For FFIs which use C ABI as a least common denominator, but I'm sure also some header-only C libraries, may not use any stdlib externs, but might still need accoutrements of the C stdlib headers (e.g. types.h). It might be nice to provide a way to leverage zig's header resolution logic without doing
linkSystemLibrary("c")
which would unnecessarily bring in libc into the project.The text was updated successfully, but these errors were encountered: