Load multiple instances of shared library which in

2019-03-06 12:46发布

I have a GFORTRAN code which needs to load multiple instances of the same shared library (.so) in different folder path. This shared library is in PASCAL and contains public variables and dlopen calls (using LoadLibrary function) for loading external .so.

In my GFORTRAN code, I tried RTLD_LAZY=1 and RTLD_NOW=2 in dlopen. It is loading the .so but I suspect that the variables are shared (If I run each instances in each thread using openMP, I could see that the values I set for a variable in thread 1 is overwritten in the thread 2).

Alternatively, I tried dlmopen with LM_ID_BASE based on the question but same issue with the variable sharing. When I tried LM_ID_BASE for first instance and LM_ID_NEWLM for second instance, I get symbol lookup error: /home/selva/libclusol.so: undefined symbol: memset, version GLIBC_2.2.5

Any suggestion?

Note: My .so is built using FPC and it has lot of public variables, loadlibrary calls (internally uses dlopen) and few functions exported which I use in GFORTRAN

0条回答
登录 后发表回答