LDC: Apply dflags affecting symbol visibility to all deps#2660
LDC: Apply dflags affecting symbol visibility to all deps#2660kinke wants to merge 6 commits intodlang:masterfrom
Conversation
|
✅ PR OK, no changes in deprecations or warnings Total deprecations: 0 Total warnings: 0 Build statistics: statistics (-before, +after)
executable size=5318488 bin/dub
-rough build time=61s
+rough build time=62sFull build output |
|
Example scenarios:
TODO:
|
|
Would be super nice to be able to get rid of Our flags are: Does |
Nope, that flag really only affects linking, not compilation. And I think LDC defaults to static |
|
My one concern (apart from code review), is that this would be better suited to be handled from a pretty significant refactor in the form of placing directives to have the relationship to other packages of |
fee329f to
b58ba5c
Compare
ae1362d to
c8747a9
Compare
|
no longer draft? in that case also adjust title pls |
Example scenarios on Windows: * If an .exe is linked against druntime/Phobos DLLs (e.g., to enable loading other D DLLs, all sharing central druntime/Phobos), all static-lib dub dependencies need to be compiled with `-dllimport=defaultLibsOnly` too [the default with `-link-defaultlib-shared`]. * To make large DLLs with few selective `export`ed symbols work after dlang#2412, the implicit flags need to be overridden - for the DLL itself and all its static-lib dependencies. This can currently only be accomplished by setting the DFLAGS environment variable. This PR enables overriding these `dflags` either in the DLL root project/ config directly, or in some dependency shared by multiple DLLs/ executables. E.g., at Symmetry, we have an .exe with lots of plugin DLLs. All plugins and the .exe have a shared dependency, so adding `dflags "-fvisibility=hidden" "-dllimport=defaultLibsOnly" platform="windows-ldc"` once in the dub.sdl of that shared dependency suffices to compile *everything* with those required flags.
|
Rebased, changelog entry added, and not passing stuff down to shared-library deps. While I fully agree that there would ideally be a generic way of controlling the flags propagation, this automatism solves a number of use cases which can currently only be handled by setting the DFLAGS env variable. As DMD seems to be adopting the relevant LDC switches ( |
On Windows.