Java: load shared libraries with dependencies

前端 未结 6 1941
别那么骄傲
别那么骄傲 2021-02-14 16:43

I am wrapping a shared library (written in C) with Java using JNA. The shared library is written internally, but that library uses functions from another external library, which

6条回答
  •  耶瑟儿~
    2021-02-14 17:26

    OK;

    I have found an acceptable solution in the end, but not without significant amount of hoops. What I do is

    1. Use the normal JNA mechanism to map the dlopen() function from the dynamic linking library (libdl.so).
    2. Use the dlopen() function mapped in with JNA to load external libraries "ext1" and "ext2" with the option RTLD_GLOBAL set.

    It actually seems to work :-)

提交回复
热议问题