-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Zig Version
0.15.1
Steps to Reproduce and Observed Behavior
I am currently developing some tooling to support one of my use-cases where i combine Zig and the JVM. That usually means compiling zig code to dynamic libraries and loading them dynamically on the JVM. But my problem is not specific to this use-case, just as a background story.
I noticed when compiling a dynamic library for a windows target, zig by default generates a import library. Emition of the ImpLib can be adjusted via the --fno-emit-implib Flag for zig build-lib, but i have not found a way of doing the same with zig build. Maybe i missed it, but if it's not present yet i think it would be good to have.
During my testing i also stumbled onto another weird behavior. The generated import lib gets placed in the lib folder inside the zig-out directory. But the actual dll file gets placed in the bin directory together with generated binaries. I don't know if this is on purpose, but it makes it extra difficult for me. I need to process the compiled libraries afterwards, so i need to add a uncomfortable hack to find the correct library depending on the platform. It is also kinda counter-intuitive to have the dynamic library in the folder for executables.
Expected Behavior
Ideally i would have a flag in the addLibrary options, or in some other options struct, to control the generation of ImpLib. It would also be nice if i could disable pdb generation in the same spot. I don't think any of those files are actually useful for importing via FFI. But they are good to have for developers that want to import in a more c way. I think a configuration, like is already present in build-lib, is the right option, but im open for suggestions.
For the paths I feel like placing everything in the lib folder that is related to libraries is the best option. But I am not sure what uses the current mapping might have, so please discuss.