-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
LDC: Use -fvisibility=public -dllimport=all
when compiling a Windows DLL
#2412
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s DLL As `-shared` can only be used when linking the DLL in the same cmdline too. On Windows, `-shared` changes the defaults of some important settings wrt. dllim/export, so specify those explicitly when *compiling* a DLL with dub (or some static lib dependency thereof etc.).
thewilsonator
approved these changes
Aug 20, 2022
kinke
added a commit
to symmetryinvestments/ldc
that referenced
this pull request
May 10, 2023
…that custom dub dub was customized to apply dflags affecting symbol visibility to *all* deps with LDC on Windows, something we need for SIL and plugins on Windows (adding `-fvisibility=hidden` and `-dllimport=defaultLibsOnly` in lang's dub.sdl). The previous ldc2.conf tweaks aren't sufficient anymore after dlang/dub#2412. See symmetryinvestments/dub@0158ab3.
kinke
added a commit
to symmetryinvestments/ldc
that referenced
this pull request
May 10, 2023
…that custom dub dub was customized to apply dflags affecting symbol visibility to *all* deps with LDC on Windows, something we need for SIL and plugins on Windows (adding `-fvisibility=hidden` and `-dllimport=defaultLibsOnly` in lang's dub.sdl). The previous ldc2.conf tweaks aren't sufficient anymore after dlang/dub#2412. See symmetryinvestments/dub@0158ab3.
kinke
added a commit
to symmetryinvestments/ldc
that referenced
this pull request
May 12, 2023
…that custom dub dub was customized to apply dflags affecting symbol visibility to *all* deps with LDC on Windows, something we need for SIL and plugins on Windows (adding `-fvisibility=hidden` and `-dllimport=defaultLibsOnly` in lang's dub.sdl). The previous ldc2.conf tweaks aren't sufficient anymore after dlang/dub#2412. See symmetryinvestments/dub@0158ab3.
kinke
added a commit
to symmetryinvestments/ldc
that referenced
this pull request
May 12, 2023
…that custom dub dub was customized to apply dflags affecting symbol visibility to *all* deps with LDC on Windows, something we need for SIL and plugins on Windows (adding `-fvisibility=hidden` and `-dllimport=defaultLibsOnly` in lang's dub.sdl). The previous ldc2.conf tweaks aren't sufficient anymore after dlang/dub#2412. See symmetryinvestments/dub@0158ab3.
kinke
added a commit
to symmetryinvestments/ldc
that referenced
this pull request
May 14, 2023
…ster with that custom dub dub was customized to apply dflags affecting symbol visibility to *all* deps with LDC on Windows, something we need for SIL and plugins on Windows (adding `-fvisibility=hidden` and `-dllimport=defaultLibsOnly` in lang's dub.sdl). The previous ldc2.conf tweaks aren't sufficient anymore after dlang/dub#2412. See symmetryinvestments/dub@0158ab3.
kinke
added a commit
to kinke/dub
that referenced
this pull request
Aug 18, 2023
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.
kinke
added a commit
to kinke/dub
that referenced
this pull request
Aug 19, 2023
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.
kinke
added a commit
to kinke/dub
that referenced
this pull request
Sep 4, 2023
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.
kinke
added a commit
to symmetryinvestments/dub
that referenced
this pull request
Sep 4, 2023
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.
kinke
added a commit
to symmetryinvestments/dub
that referenced
this pull request
Sep 11, 2023
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.
kinke
added a commit
to symmetryinvestments/dub
that referenced
this pull request
Dec 5, 2023
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.
kinke
added a commit
to kinke/dub
that referenced
this pull request
Jan 11, 2024
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As
-shared
can only be used when linking the DLL in the same cmdline too. On Windows,-shared
changes the defaults of some important settings wrt. dllim/export, so specify those explicitly when compiling a DLL with dub (or some static lib dependency thereof etc.).[extracted from #2396]