dlopen run time symbol resolution
I am using ldopen for dynamic modules under unix.
There are 3 classes.
Base
Foo : public Base
Bar : public Base
Base exists in the mail program, and Foo and Bar are
dynamically loaded. Foo is loaded FIRST, and then
Bar SECOND.
Bar has a function called barPrint which does not
exists in the Base class.
Foo calls barPrint after Bar has been loaded.
^^^
Ok, so in other words, at dlopen time Foo will be
unable to resolve the Bar::barPrint function. So
we use RTLD_LAZY to open Foo. The symbols from
Bar will also need to be available to Foo when
Foo calls it, so we need to load Bar with RTLD_GLOBAL.
However, it doesn't appear to work. Has anyone done
this before? Can anyone take a look at this? :)
( Source example here )
You can switch around the dlopen between Foo and Bar in main.cpp and see that it works
fine if it loads Bar and then Foo.
Thanks for the help
-eurijk! >;-)
There are 3 classes.
Base
Foo : public Base
Bar : public Base
Base exists in the mail program, and Foo and Bar are
dynamically loaded. Foo is loaded FIRST, and then
Bar SECOND.
Bar has a function called barPrint which does not
exists in the Base class.
Foo calls barPrint after Bar has been loaded.
^^^
Ok, so in other words, at dlopen time Foo will be
unable to resolve the Bar::barPrint function. So
we use RTLD_LAZY to open Foo. The symbols from
Bar will also need to be available to Foo when
Foo calls it, so we need to load Bar with RTLD_GLOBAL.
However, it doesn't appear to work. Has anyone done
this before? Can anyone take a look at this? :)
( Source example here )
You can switch around the dlopen between Foo and Bar in main.cpp and see that it works
fine if it loads Bar and then Foo.
Thanks for the help
-eurijk! >;-)
