hello

i've written a testprogram to check how dynamic linking
works for C++ code, specially for class, when are global objects'
ctors and dtors are being called etc.

however, i've run into a very strange problem.
in the main program i have a "class module", which has
a virtual destructor. The dlopen()'d module has a class
derived from this one.

Main program:
class module {
 public:
  module();
  virtual ~module();
};

mod_bar:
class modbar: public module {
 public:
  modbar(): module() {};
  ~modbar() {};
};

Of course the main program's module class's methods are
not just declared they are also defined elsewhere.

This is the way i try to dlopen() mod_bar:

 if ( !(dh = dlopen(MOD_BAR, RTLD_NOW|RTLD_GLOBAL)) ) {
 ...
 }

i've got the following error message when running the code:
Unable to dlopen(lib/mod_bar.so): lib/mod_bar.so: Undefined symbol 
"_ZN6moduleD2Ev"

however, i've check the testprogram:
$ nm bin/dltest | grep _ZN6moduleD2Ev
08048918 T _ZN6moduleD2Ev

so it does exist.

i've tried to compile the binaries both without and without -fpic -fPIC,
but nothing had changed.

the question is, what am i doing wrong? according to the symbols,
the dynamic linker should be able to load that symbol, however it doesn't.
what do i need to do to fix this?

looking forward for answers,

Bye,

Gergely Czuczy
mailto: [EMAIL PROTECTED]

-- 
Weenies test. Geniuses solve problems that arise.

Attachment: pgpPWpOXijve2.pgp
Description: PGP signature

Reply via email to