C++ java加载一个DLL,从JNI中导出另一个DLL的方法
我做了一个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中的load不会给出任何错误,但是当我想使用我的原生方法时,我会得到一个
java.lang.UnsatisfiedLinkError:
在我的项目中,两个DLL位于同一文件夹中。在VisualStudio中工作时,它工作正常,但JNI中的导出有问题。JNI onLoad在java中也不会触发
谢谢
# 1 楼答案
我很笨,我所有的JNI导出方法都有一个名称空间。 因此,他们没有被处决。现在它起作用了