Support -static and -dynamic .lib suffixes on Windows#13473
Merged
straight-shoota merged 7 commits intocrystal-lang:masterfrom May 23, 2023
Merged
Support -static and -dynamic .lib suffixes on Windows#13473straight-shoota merged 7 commits intocrystal-lang:masterfrom
-static and -dynamic .lib suffixes on Windows#13473straight-shoota merged 7 commits intocrystal-lang:masterfrom
Conversation
Contributor
Author
|
Some symbols from This reveals a bug where a Also note that in this case the executable does not know about the names of the symbols imported using ordinals (e.g. 115 is |
straight-shoota
approved these changes
May 17, 2023
Member
straight-shoota
left a comment
There was a problem hiding this comment.
I just have a small suggestion for a little optimization.
But it's optional. I'm approving either way.
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.
As described in #11575 (comment), this PR makes the Crystal compiler look for
foo-static.libbeforefoo.libin each library search directory on Windows, andfoo-dynamic.libbeforefoo.libif-Dpreview_dllis specified. Onlyfoois affected; any path separator (/or\) will disable the extra suffix behavior.This will allow us to finally distribute static and DLL import libraries side-by-side in
CRYSTAL_LIBRARY_PATH. The next step would be having CI collect the import libraries into$ORIGIN/lib/*-dynamic.lib, and the DLLs themselves into$ORIGIN/*.dll. The DLLs do not have their own directory since Crystal itself might look them up in the same directory as the executable.This PR also enables delay-loading for all DLLs, even when
-Dpreview_dllis not used. This is not a problem for static libraries because they simply do not import DLLs (this is already the case when the Crystal interpreter loads those .lib files).