Sorry, but I think your comment is irrelevant: the function is linked
with extern "C", hence name demangling is not necessary. Besides, the
function is called properly, which is manifested by the fact that it
does what it should if libfoo.so is not linked with a c++ lib.

I additionaly discovered that if I do

  dlopen("/usr/lib/libstdc++.so.6",RTLD_LAZY);

prior to dlopening the other library, no error occurs (and it does
without that, as originally reported):

 == main.c ==
 #include<dlfcn.h>
 int main(void){
  dlopen("/usr/lib/libstdc++.so.6",RTLD_LAZY); 
  void* handle=dlopen("./libfoo.so",RTLD_NOW);
  void(*foo)()=(void(*)())dlsym(handle,"foo");
  foo();
  return 0;
 }

I think there is an issue with c++ initialization code not being run
properly, unless the stdc++ is opened directly (rather than by ld.so at
runtime), but I don't know details.

-- 
cerr crash in dlopen'ed c++ shared object, if linked to some libs
https://bugs.launchpad.net/bugs/490744
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to