Skip to content

Commit 5974adb

Browse files
committed
[add changelog entry]
1 parent 7378056 commit 5974adb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

changelog/ldc_visibility.dd

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
LDC: Apply dflags affecting symbol visibility to all deps
2+
3+
The `-fvisibility` (and, on Windows, `-dllimport` and `-link-defaultlib-shared`)
4+
flags in effect for some root project are now passed down to all (direct and indirect)
5+
dependencies of that root project - when using LDC. This is mainly important on
6+
Windows, for executables linked against shared druntime/Phobos, as well as DLLs.
7+
8+
For Windows executables to be linked against the druntime/Phobos DLLs via
9+
`-link-defaultlib-shared`, this means that all its static-library dub dependencies
10+
are now automatically compiled with `-link-defaultlib-shared` too, thus defaulting to
11+
`-dllimport=defaultLibsOnly`, which is a (Windows-specific) requirement for this
12+
scenario.
13+
14+
With LDC, code ending up in a Windows DLL is compiled with `-fvisibility=public
15+
-dllimport=all` by default (implicit flags added by dub). This can now be overridden
16+
via e.g. `-fvisibility=hidden -dllimport=defaultLibsOnly` to generate a DLL exporting
17+
only select symbols with explicit `export` visibility and linking all dub deps
18+
statically (but druntime/Phobos dynamically). If you want to additionally link druntime
19+
and Phobos statically into the DLL, use `-link-defaultlib-shared=false
20+
-fvisibility=hidden -dllimport=none` instead.

0 commit comments

Comments
 (0)