I think that all the missing symbols are from the abstract base class
of the one being defined in the library.
Any ideas why this sort of thing happens?
Thanks,
Cyan
dlopen fails with:
undefined symbol: __ti6Finder
Automake said:
/bin/sh ../../../libtool --mode=compile --tag=CXX c++ -DHAVE_CONFIG_H
-I. -I. -I../../.. -I/usr/include/kde -I/usr/include/qt
-I/usr/X11R6/include -D_REENTRANT -O2 -O0 -g3 -Wall -fno-exceptions
-fno-check-new -c fpsmgnlz1.cpp
c++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I/usr/include/kde
-I/usr/include/qt -I/usr/X11R6/include -D_REENTRANT -O2 -O0 -g3 -Wall
-fno-exceptions -fno-check-new -Wp,-MD,.deps/fpsmgnlz1.pp -c
fpsmgnlz1.cpp -fPIC -DPIC -o .libs/fpsmgnlz1.o
In file included from fpsmgnlz1.h:20,
from fpsmgnlz1.cpp:26:
../../finder.h:126: warning: `class Finder' has virtual functions but
non-virtual destructor
In file included from fpsmgnlz1.cpp:26:
fpsmgnlz1.h:57: warning: `class PupilSpotMarginalize1' has virtual
functions but non-virtual destructor
/bin/sh ../../../libtool --mode=link --tag=CXX c++ -O2 -O0 -g3 -Wall
-fno-exceptions -fno-check-new -o libfpsmgnlz1.la -rpath
/usr/local/kde/lib -version-info 0:0:0 fpsmgnlz1.lo -limageutil
rm -fr .libs/libfpsmgnlz1.la .libs/libfpsmgnlz1.lai
.libs/libfpsmgnlz1.so .libs/libfpsmgnlz1.so.0 .libs/libfpsmgnlz1.so.0.0.0
c++ -shared -nostdlib /usr/lib/crti.o
/usr/lib/gcc-lib/i386-linux/2.95.4/crtbeginS.o .libs/fpsmgnlz1.o
-limageutil -lqt -L/usr/lib/gcc-lib/i386-linux/2.95.4 -lstdc++ -lm -lc
-lgcc /usr/lib/gcc-lib/i386-linux/2.95.4/crtendS.o /usr/lib/crtn.o -O2
-O0 -g3 -Wall -fno-exceptions -fno-check-new -Wl,-soname
-Wl,libfpsmgnlz1.so.0 -o .libs/libfpsmgnlz1.so.0.0.0
How are you loading it into your program? Try not to use RTLD_GLOBAL because it
forces symbols in your .SO file to be global within your app.
This is my dynamic loader:
Boolean MPlugin::openlib(char *name)
{
m_dll = dlopen(name, RTLD_NOW);
if(!m_dll)
{
char buffer[PATH_MAX];
mferr.mfprintf("MPlugin dlopen Error: %s %s\n", name,
dlerror());
getcwd(buffer, sizeof(buffer));
sprintf(&buffer[strlen(buffer)], "/%s", name);
m_dll = dlopen(buffer, RTLD_NOW);
}
if(!m_dll)
mferr.mfprintf("MPlugin dlopen Error: %s %s\n", name,
dlerror());
return m_dll ? TRUE : FALSE;
}
Here is how I get function pointers:
void *MPlugin::getpfn(char *name)
{
void * pfn = dlsym(m_dll, name);
if(!pfn)
mferr.mfprintf("MPlugin dlsym Warning: %s\n", dlerror());
return pfn;
Cyan
Hmm, how are you compiling your shared object?
It might be useful to check if your shared library is complete by
trying to link it with a stub program:
echo 'int main() { return 0; }' > progtemp.cpp
g++ progtemp.cpp libfpsmgnlz1.so
This will display all undefined references, while dlerror() only
reports the first one.
This sort of verification can be integrated in a makefile's 'check'
target.
[...]
> ../../finder.h:126: warning: `class Finder' has virtual functions but
> non-virtual destructor
> In file included from fpsmgnlz1.cpp:26:
> fpsmgnlz1.h:57: warning: `class PupilSpotMarginalize1' has virtual
> functions but non-virtual destructor
It wouldn't hurt to fix those warnings.
--
Pierre Sarrazin <sarrazip at sympatico dot ca> http://sarrazip.com/en/