-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linking static library using C++/CX with C++/WinRT runtime component fails #1053
Comments
To note that we cannot update the proprietary lib files using C++/CX to use C++/WinRT, they are provided to us by a third-party and are closed source. |
This sounds more like a question for the C++ team. I suspect they're using incompatible versions of the CRT. Static libs (I believe) need to all use the same CRT in order to be compiled together into a single binary. For C++/WinRT you can use whatever CRT is supported by Visual C++. For C++/CX you're at the mercy of whatever CRT it supports. |
Yeah, I'll see if I can get it to use the CRT that CX is using. Enabling C++/CX but not using it on the runtime component project might work, but prevents us from using C++20, which we would like to use... |
Yes, I don't think the C++ team is going to support C++20 with C++/CX. |
Ok so the fix on StackOverflow does work, but forgets to mention something critical. All the C++/CX libraries you want to use have to be specified before any other library (including vccorlib and msvcrt), meaning you can't use project references (because that adds the
Without this, the linker will start scanning other .libs, find some references to msvcrt.lib and then load that, while when the C++/CX library is first, it will scan that first, find references to vccorlib.lib, and load it first. Wrong order:
Right order:
|
/ZW
, and write a dummy function making use of C++/CX, like so:foo()
:At work (unrelated to issue 1048, which is personal projects), we are migrating to C++/WinRT for all our own code, but must link to proprietary libraries for various DRM functions which use C++/CX internally. This issue is preventing us from using C++/WinRT entirely.
I tried following this Stack Overflow post, but the answers posted did not help.
The text was updated successfully, but these errors were encountered: