Hi @nippy ,
UWP C++/CX can load win32 and UWP dynamic DLL. Here are my test steps:
DLL(Win32 or UWP)
- Create DLL project, name "DllTest".
- Add extern "C" content in "Pch,h".
extern "C"
{
_declspec(dllexport) void mainDll(double a, double b, double* aplusb);
}
- Add function content in "Pch.cpp".
#include "pch.h"
void mainDll(double a, double b, double* aplusb)
{
*aplusb = a + b;
}
- Rebuild the project, find the dll file in output file, copy it to the AppX file of UWP project. It is recommended to modify the Output Directory.
UWP(C++/CX):
- Create UWP C++/CX project, its name is App2.
- Add code about calling the dll.
HINSTANCE hDLL = LoadLibrary(L"DllTest.dll");
typedef void (*func)(double a, double b, double* aplusb);
func callDll = (func)GetProcAddress(hDLL, "mainDll");
double a = 1, b = 2, result;
callDll(a, b, &result);
- Check the value of result, it should be 3.
Thank you.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.