Date: Wed, 27 Dec 2006 18:09:41 +0100 From: Gergely CZUCZY <phoemix@harmless.hu> To: freebsd-hackers@freebsd.org Subject: unresolved symbol for C++ class dtor Message-ID: <20061227170941.GA44402@harmless.hu>
next in thread | raw e-mail | index | archive | help
--5vNYLRcllDrimb99 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =3D 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 "_ZN6mod= uleD2Ev" 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: gergely.czuczy@harmless.hu --=20 Weenies test. Geniuses solve problems that arise. --5vNYLRcllDrimb99 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) owF1Vc9vG0UUDq3gMKKHHjjzGiHZVrwbJzGN6yhKmzgKSGmDgqtKcIhmd2a908zO bGdmvXGalAsHkDhUvYLgygWpElyQkPgLQEKIO/8BHDiCxJu115giJMuaeTPzve99 78c+vXZ16cr1H59/8/7KJ88+femrV9ailaxwTo2CjJqxUMFap7MWdLvdznqwEbzJ 443eRty9uUm7m71Od//Zl7/saeW4csFwkvM+O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uX5l87elz8MPLs5++vB48Of6r989vfUxeet859Wl L9jzn8fRt79//0Pjtc++Xs7/uvHuH6//DQ== =U1DI -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061227170941.GA44402>