EnJ
EnJ

Reputation: 197

Access file in UWP using statically built non-UWP lib

In my UWP, I link a statically built lib, which is built on Win32. I need to use this lib to access file, more specifically using this lib to do deserialization and I am not sure if I can use it in UWP. If not, do I need to rewrite deserialization using UWP?

Thanks.

YL

Upvotes: 2

Views: 294

Answers (1)

Xie Steven
Xie Steven

Reputation: 8591

I am not sure if I can use it in UWP. If not, do I need to rewrite deserialization using UWP?

It dependents on which APIs that you've used in your win32 library. Not all win32 APIs are available in UWP. You could check Win32 and COM APIs for UWP apps for more details.

In the case of a static library, you can link to your library simply by adding the library (.lib file) to your linker input, just as you would in a classic Win32 application. For libraries where only a binary is available, this is the only option. A static library is linked into your app's executable, but a Win32 DLL that you consume in a UWP app must be packaged into the app by including it in the project and marking it as Content. To load a Win32 DLL in a Universal Windows Platform app, you also have to call LoadPackagedLibrary instead of LoadLibrary or LoadLibraryEx.

Please read How to: Use Existing C++ Code in a Universal Windows Platform App for more reference.

Upvotes: 2

Related Questions