-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Windows: Add -dllimport CLI option for more selective implicit dllimports #3763
Conversation
* Newly require `-link-defaultlib-shared` for implicit dllimport. E.g., this enables to compile druntime DLL with `-fvisibility=public` for pure exports and no (local) imports (such as builtin TypeInfos). * `-link-defaultlib-shared` alone now only implicitly imports symbols from druntime/Phobos. This simplifies building complex DLLs linked against a bunch of static libs (dub only supports static lib dependencies!); the static libs don't need to be compiled with `-fvisibility=public` anymore (if the DLL itself isn't either), `-link-defaultlib-shared` is sufficient. This is mainly useful for existing DLLs with explicit exports, to make them link against *shared* druntime/Phobos and so end up with a single druntime/Phobos for the whole process.
0d57325
to
9865e45
Compare
With this proposal, the option of only dllimporting (~all external D globals) without own dllexports (previous Until now, I've tried to handle these implicit dllimports without extra cmdline option, to keep things reasonably simple. Maybe an explicit option is better; having to use |
I've tested this for an executable with ~150 dub dependencies (incl. big ones like vibe-d; all static libs), wanting to link it against shared druntime/Phobos - by enforcing This led to 21 undefined symbols; some TLS variables ( |
After some fixes, down to 1 undefined symbol (ModuleInfo) - there are 3rd-party packages in |
No more linker errors, but hitting #3690 apparently. |
7a06341
to
db4faf3
Compare
-link-defaultlib-shared
for implicit dllimport.E.g., this enables to compile druntime DLL with
-fvisibility=public
for pure exports and no (local) imports (such as builtin TypeInfos).-link-defaultlib-shared
alone now only implicitly imports symbols from druntime/Phobos.This simplifies building complex DLLs linked against a bunch of static libs (dub only supports static lib dependencies!); the static
libs don't need to be compiled with
-fvisibility=public
anymore (if the DLL itself isn't either),-link-defaultlib-shared
is sufficient.This is mainly useful for existing DLLs with explicit exports, to make them link against shared druntime/Phobos and so end up with a single druntime/Phobos for the whole process.