Answered by:

How to load Win32 dll for Metro style App

Question

I have several win32 dlls, which are written in native c++ but don't invoke any win32 API. These dlls implement the core logic for my application. Now I want to create a new Metro style App, which need to invoke the api exposed from these existing Win32
dlls. I know I need to compile these Win32 dlls with VS2012.

Before I porting these dlls to VS2012, I create a simplest Win32 dll for testing. This dll just exposed a Add() api like this:

extern "C" _declspec(dllexport) int Add(int x,int y);

And I create a Windows store App, which load the Win32 dll and invoke the Add() function like below:

This is an English language forum. It would help if you would translate the error into English.

That said, did you mark the DLL as Content to be copied into the app package when the package is built? LoadPackagedLibrary loads custom DLLs which are included in the app's package. The app cannot use an explicit path to load a DLL from elsewhere.