-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Using Zig as C compiler for a shared library leads to undefined symbol: _DllMainCRTStartup #3237
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
Comments
Looking at all the options that can be provided for lld-link (linker for windows), I think the option
Passing this option to the linker does indeed solve the issue. Edit: According to the windows docs, that creates a resource-only DLL that contains no executable code. So probably not the correct solution then |
@FireFox317 I think that's a good way to go. However I also think there is a regression. If you grep std lib for DllMainCRTStartup you can see there is something that was supposed to be provided. I think that mess can be removed in favor of comptime logic in std/special/start.zig. |
Hmm I'm not sure if this is a bug actually. I think you're supposed to define |
Related: #3000 |
@andrewrk Isn't it against using Zig as C compiler idea, if I don't need to do that with GCC/Clang/MSVC? |
ref: #6482 |
The command:
zig build-lib --c-source test.c --library c -dynamic -target x86_64-windows-gnu
leads tolld: error: <root>: undefined symbol: _DllMainCRTStartup
error. Compilation of static library seems to work fine.The text was updated successfully, but these errors were encountered: