-
-
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
CMake: Support BUILD_SHARED_LIBS for Windows too #3704
Conversation
c7677f3
to
5c271ef
Compare
The remaining Phobos linking errors aren't looking that bad:
Edit: Updated. |
0ba11e5
to
e97c87e
Compare
Okay, all linking errors are gone:
|
Includes ldc-developers/druntime#197 now as well, i.e., using a generalized |
Looks like we're almost there:
The shared Phobos test runners represent a typical scenario: little .exe linked against 2 DLLs (druntime DLL and Phobos unittest DLL). It's also interesting because druntime is compiled all-at-once, while unittest-Phobos is compiled per-module; this affects Still TODO, OTOH:
|
484fe58
to
4cf5b0c
Compare
dc73d0d
to
b0b8f49
Compare
By compiling druntime/Phobos with `-fvisibility=public` for the new DLLs. Compiling and linking druntime works fine: > ls -lh lib/druntime-ldc* -rwxr-xr-x 1 Martin 197121 2.4M Apr 24 19:28 lib/druntime-ldc-debug-shared.dll -rw-r--r-- 1 Martin 197121 2.9M Apr 24 19:28 lib/druntime-ldc-debug-shared.lib -rw-r--r-- 1 Martin 197121 12M Apr 24 19:28 lib/druntime-ldc-debug-shared.pdb -rw-r--r-- 1 Martin 197121 8.6M Apr 24 19:28 lib/druntime-ldc-debug.lib -rw-r--r-- 1 Martin 197121 4.7M Apr 24 19:28 lib/druntime-ldc-lto.lib -rwxr-xr-x 1 Martin 197121 2.2M Apr 24 19:28 lib/druntime-ldc-shared.dll -rw-r--r-- 1 Martin 197121 2.8M Apr 24 18:46 lib/druntime-ldc-shared.lib -rw-r--r-- 1 Martin 197121 8.5M Apr 24 19:28 lib/druntime-ldc-shared.pdb -rw-r--r-- 1 Martin 197121 4.4M Apr 24 19:28 lib/druntime-ldc.lib The druntime DLL exports more than 10k symbols. The MS C runtime is linked statically; that should probably be changed to the MS DLLs too. Linking a non-Phobos hello-world app against the druntime DLL works; it unsurprisingly crashes at runtime though. The Phobos DLL can be compiled too, but linking fails (builtin TypeInfo init symbols and vtables etc.).
And add oldnames.lib and legacy_stdio_definitions.lib for the Phobos DLL, which are linked automatically with static druntime via pragma(lib) directives.
…test runner executables
… the Phobos unittest DLL
…ry linked against shared druntime
…h -link-defaultlib-shared
…ny exports with -link-defaultlib-shared
Multiple identities for symbols across DLLs/executables aren't restricted to TypeInfos and templates, but include functions too: dlang/phobos#8110 |
By compiling druntime/Phobos with
-fvisibility=public
for the new DLLs(=> #3703 included as prerequisite for now).Compiling and linking druntime works fine:
The druntime DLL exports more than 10k symbols.
The MS C runtime is linked statically; that should probably be changed to the MS DLLs too.Edit: done.Linking a non-Phobos hello-world app against the druntime DLL works; it unsurprisingly crashes at runtime though.
The Phobos DLL can be compiled too, but linking fails (builtin TypeInfo init symbols and vtables etc.).