简体   繁体   中英

Java loading a DLL that export methods from another DLL in JNI

i did a DLL that export methods from another DLL in JNI.

    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);
}

System.load in java doesn't give any errors but when i want to use my native method, i get a

java.lang.UnsatisfiedLinkError:

Both DLLs are in the same folder in my project. It was working fine when working in visual studio but there is something wrong with the export in JNI. The JNI onLoad also doesn't trigger in java.

Thanks

i am dumb, i had a Namespace over all my JNI export methods. Therefore, they were not executed. Now it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM