Hide module symbols by default#340
Merged
Lgt2x merged 1 commit intoDescentDevelopers:mainfrom May 22, 2024
Merged
Conversation
Contributor
Author
|
An alternative to marking specific symbols as exportable in the source code is to have an exported symbols list that is passed to the linker. The problem is, macOS and Windows start each symbol with an underscore, while Linux/other UNIXes do not. This would resolve the DMFC symbols being exported, though. |
Collaborator
|
I did some research on this subject and came up with some possible downsides:
|
Contributor
Author
|
Collaborator
@jcoby @winterheart @Arcnor What do you think? |
Collaborator
|
I have little experience on dll using, but changes looks fine for me. |
Lgt2x
approved these changes
May 22, 2024
| set(NETGAME_MODULE entropy) | ||
|
|
||
| add_library(${NETGAME_MODULE} MODULE ${CPPS} ${HEADERS}) | ||
| set_target_properties(${NETGAME_MODULE} PROPERTIES CXX_VISIBILITY_PRESET "hidden") |
Member
There was a problem hiding this comment.
I'm thinking about writing a custom CMake command for netgames that are all built the same way, maybe for a future contribution
This file contains hidden or 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
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.
Pull Request Type
Description
This changes the visibility of the symbols of the plug-ins, the net games, and the TCP/IP net module. This can be great for LTO and dead code stripping, as only exported symbols (and symbols that the exported symbols reference) are included, reducing the size of linked objects.
Checklist
Additional Comments
Due to how DMFC is statically-linked and built for Linux and macOS, a lot of the DMFC symbols will still be exported. The next part would be changing visibility of the DMFC library for macOS and Linux to not export its symbols if they're not building for Windows.