This repository was archived by the owner on Oct 17, 2021. It is now read-only.
Conversation
We cannot simply explicitly spell out the linked library name in general. On Windows, the name of the library is determined by the library in use and selects across the following matrix: | | Debug | Release | | --- | --- | --- | | **Static** | `libxml2sd.lib` | `libxml2s.lib` | | **Dynamic** | `xml2d.lib` | `xml2.lib` | Note that this already assumes that the dynamic MSVC library (`/MD`) build is in use. The selection between `/MD` and `/MT` is not something that can be identified by the name. Accommodating this within the modulemap is not entirely reasonable. As a result, in order to maintain compatibility with the current behaviour, I've resorted to some module level inline assembly (simply to avoid adding a source file as there is no source file currently for the module). By hand constructing the linker directives for Linux and macOS, we can continue to have the autolinking behaviour which can support all the platforms. The alternative to all this mess would be to require the user to specify the location of the import library, DSO, or TBD (depending on the platform) manually when invoking the swift build tool.
34 of 35 tasks
Contributor
|
Goodness. That's, um... much more involved than I expected. Kudos for finding a solution that works at all. And again, apologies on my end for deciding to pull in a notoriously challenging dependency for |
mattt
approved these changes
Apr 26, 2021
Contributor
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
We cannot simply explicitly spell out the linked library name in
general. On Windows, the name of the library is determined by the
library in use and selects across the following matrix:
libxml2sd.liblibxml2s.libxml2d.libxml2.libNote that this already assumes that the dynamic MSVC library (
/MD)build is in use. The selection between
/MDand/MTis not somethingthat can be identified by the name.
Accommodating this within the modulemap is not entirely reasonable. As
a result, in order to maintain compatibility with the current behaviour,
I've resorted to some module level inline assembly (simply to avoid
adding a source file as there is no source file currently for the
module). By hand constructing the linker directives for Linux and
macOS, we can continue to have the autolinking behaviour which can
support all the platforms.
The alternative to all this mess would be to require the user to specify
the location of the import library, DSO, or TBD (depending on the
platform) manually when invoking the swift build tool.