我做了一个DLL,它从JNI中的另一个DLL导出方法。
JNIEXPORT bool JNICALL getIsWordInPhonemListFR(const char* word)
{
isWordInPhonemListFR method = NULL;
BOOL fRunTimeLinkSuccess = FALSE;
HINSTANCE hGetProcIDDLL = LoadLibrary(L"PhoneticEngineFR2.dll");
if (!hGetProcIDDLL) {
std::cout << "kcould not load the dynamic library" << std::endl;
}else{
method = (isWordInPhonemListFR)GetProcAddress(hGetProcIDDLL, "isWordInPhonemListFR");
}
return method(word);
}
Java中的System.load没有给出任何错误,但是当我想使用本机方法时,我得到了
这两个DLL都在我的项目中的同一文件夹中。在Visual Studio中工作时工作正常,但JNI中的导出存在问题。 JNI onLoad也不会在Java中触发。
谢谢
最佳答案
我很笨,我所有的JNI导出方法都有一个命名空间。
因此,它们没有被执行。现在可以了。