Add minimal load-time DLL support on Windows, support dllimport
storage class
#11573
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.
This patch is required for minimal support of load-time dynamic linking on Windows. For this to work,
CRYSTAL_LIBRARY_PATH
, which we will use to place the .lib and .exp files. SetCRYSTAL_LIBRARY_PATH
to point to it;./bdwgc/Release/gc.lib
and./pcre/Release/pcre.lib
to theCRYSTAL_LIBRARY_PATH
we just set. Same for the associated .exp files;gc.dll
andpcre.dll
in the same directory as thepcretest.exe
executable;Without this patch, the compilation step would fail with:
This PR thus adds the
dllimport
storage class to any external lib variables, through LLVM.The
-Dpreview_dll
flag is also added because currently the compiler defaults to static builds on Windows, even without the--static
build flag, and everything would immediately break if the current command line suddenly starts using dynamic linking. With a minimal working example we can later sort out the details for dynamic linking on Windows.