我寫的Visual C++的dll與如下一個JNIEXPORT功能:我怎麼能說JNIEXPORT功能從DLL在其他C++ DLL
extern "C"
{
JNIEXPORT int JNICALL sum()
{
return 1;
}
}
我想調用其他的Visual C這個函數+ DLL如下:
typedef int(__stdcall *f_funci)();
HINSTANCE hGetProcIDDLL = LoadLibrary("C:/.../JNIdllTest.dll");
if (!hGetProcIDDLL) {
std::cout << "could not load the dynamic library" << std::endl;
return EXIT_FAILURE;
}
f_funci funci = (f_funci)GetProcAddress(hGetProcIDDLL, "sum");
if (!funci) {
std::cout << "could not locate the function" << std::endl;
return EXIT_FAILURE;
}
std::cout << "funci() returned " << funci() << std::endl;
return EXIT_SUCCESS;
但是當我運行它,這個錯誤發生
無法定位功能
我該怎麼辦?