c++ - Perl modules with native libs: Possible to get XSLoader to use RTLD_GLOBAL on dlopen? -
the title gives short version; long of have c++ api wrapped c & exposed perl via xs. has worked fine number of years, have run use-case suspect may caused duplicate load of common library.
the symptom have in-house perl wrapper around tibrv. and, we've wrapper around c++ api internally uses tibrv. when perl script uses both of these apis, second hangs on creating tib transport. individually, both work perl.
i suspect, have nothing up, somehow has shared state , perl, default loading libraries rtld_local
set, may causing issue (this pure hunch). have nothing with, know tib aware of surroundings, think possibility.
my question: possible use dlopen
flags, such rtld_global
perl's xsloader
? i.e. can 1 change dlopen
flags when native lib opened without rebuilding perl/xs?
everything i've seen online far seems indicate need use dynaloader, require rebuild our lib (because of means in export our c++ symbols) in manner suitable use dynaloader (which not).
i'm 10% solve real problem, knowing if can override dlopen
flags allow possibly save few days effort.
xsloader front-end dynaloader.
sounds can add
sub dl_load_flags { 0x01 }
to module. gets called , passed dl_load_file
in flags
, does:
if (flags & 0x01) #ifdef rtld_global mode |= rtld_global; #else perl_warn(athx_ "can't make loaded symbols global on platform while loading %s",filename); #endif dldebug(1,perlio_printf(perl_debug_log, "dl_load_file(%s,%x):\n", filename,flags)); handle = dlopen(filename, mode) ;
note dl_load_file
called load .so
compiled .xs
. far know, xsloader/dynaloader doesn't call dlopen
libraries object might use, such 1 having problems.
Comments
Post a Comment