
On 7/11/07, Janek Kozicki <janek_listy@wp.pl> wrote:
Stephan Diederich said: (by the date of Wed, 11 Jul 2007 21:52:32 +0200)
First, the executable needs to be linked with "-rdynamic". With that flag
I confirm that. To write my own plugin loading library on linux I had to use -rdynamic flag almost everywhere (for plugins too!).
Second, the call to dlopen a library should be passed RTLD_GLOBAL. With that
However i don't need to do anything with regard to RTLD_GLOBAL
I gave it a try with another testcase. It is attached to this mail, but is a bit clumsy. There are 3 directories: src (with the main app), lib1 and lib2. (the tests are handmade) The first test is to create a boost::any in lib1 and try to extract it in main. This works, as long as the executable is linked with -rdynamic. (the lib doesn't need it). dlopen flags don't matter, too. The second testcase is to create a boost::any in lib1, and try to extract it in lib2. This works, as long as the first lib is opened with RTLD_GLOBAL flag. If the executable is linked _with_ -rdynamic all 3 modules now have the same typeinfos. But this testcase even works _without_ the -rdynamic flag. Then lib1 and lib2 share the same typeinfos, but the executable has a different one (and cannot do anything with the boost::any from the libs) HTH, Stephan