-
Notifications
You must be signed in to change notification settings - Fork 46
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
Proper way to reuse c headers from the exposed lua library #78
Comments
Hey @bfredl! This is a use case I'm working on right now. Currently your approach is what I'm planning to do. Just a few months ago actually, using I actually have a draft blog post (waiting for Zig 0.12.0 to stabilize the APIs) that shows how to compile LPeg linked against Ziglua in a project: https://bc4b5350.nathancraddock.pages.dev/blog/ziglua-package/#compiling-lpeg Am I understanding your question correctly? |
Yes, that's exactly what I want. Including lpeg specifically, I discovered and had to work around the |
Great! I'll keep this issue open for a bit. You raised some questions about linkers and I want to make sure that this approach is correct. Once I have confirmed that, and have this process documented I'll close it. |
Thanks. Just one more piece of information in case if it useful for anyone: I also needed to get the lua include path as a |
In addition to using the
@import("ziglua")
module from zig code, I need to compile additional C extensions which depend on the headers for the correct lua version as exposed byziglua
.After some trial and error I found this to work:
This feels a bit hacky as it relies on the artifact name
"lua"
which might be seen as internal to ziglua (not part of the exported module), and also, as addImport by itself is enough to add the .o files for the lua library,linkLibrary
would add the same objects a second time?This should "safely" be handled gracefully by most linkers, but it would be best to avoid this if possible.
Any thoughts about what the proper way would be?
The text was updated successfully, but these errors were encountered: