Skip to content
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

Creating a DLL on Windows with zig cc does not produce an import library (.lib) #9210

Closed
alexrp opened this issue Jun 23, 2021 · 1 comment · Fixed by #9347
Closed

Creating a DLL on Windows with zig cc does not produce an import library (.lib) #9210

alexrp opened this issue Jun 23, 2021 · 1 comment · Fixed by #9347
Labels
bug Observed behavior contradicts documented or intended behavior os-windows zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@alexrp
Copy link
Member

alexrp commented Jun 23, 2021

An import library is, depressingly, still required in 2021 to link against a DLL on Windows. LLD is not yet capable of linking directly against a DLL like MinGW's linker.

Normally, when you link C code with lld-link -dll foo.obj, you'll get both foo.dll and foo.lib. This also appears to be the case with zig build-lib -dynamic. However, with zig cc -shared, this is not the case, and -Wl,-implib:foo.lib does not work either.

@Vexu Vexu added bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature labels Jun 23, 2021
@Vexu Vexu added this to the 0.8.1 milestone Jun 23, 2021
@alexrp
Copy link
Member Author

alexrp commented Jun 23, 2021

By the way, if anyone can point me in the right direction, I could try to put a PR together for this. I can't for the life of me figure out where Zig makes the decision to emit an import library for zig build-dll -dynamic though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior os-windows zig cc Zig as a drop-in C compiler feature
Projects
None yet
3 participants