Support windows linking with xrt_coreutil_static without dllimport #8586
+52
−38
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.
Problem solved by the commit
Add a preprocessor directive to turn off dllimport decoration of exported symbols when exported APIs are intended to be statically linked into some external target.
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
On windows LNK4217 means that a symbol defined in one object (e.g., a static link library) is being imported by another object. In order to avoid this situation, the
__declspec(dllimport)
modifier should be removed from the object that uses the symbol.How problem was solved, alternative solutions (if any) and why they were rejected
This PR simply adds
XRT_STATIC_BUILD
preprocessor directive that can be used when compiling objects that use XRT symbols and link to static libraries from XRT.Risks (if any) associated the changes in the commit
The changes in this PR are target for
xrt_coreutil_static
usage only, specifically for use in a user-mode-driver for DirectML.