bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lt_dlerror() and error output...


From: Eric Bleher
Subject: lt_dlerror() and error output...
Date: Tue, 30 Apr 2002 17:48:22 +0200 (CEST)

I'm using libtool version 1.4.2 (1.922.2.53 2001/09/11
03:18:52) with automake 1.6 / autoconf 2.53 unter suse
linux 7.2.

I want to use the libltdl librairie instead of
standard linux dlopen... utilities.

But the lt_dlerror() function seems not to work so
good as dlerror() function.

Here is a part if my source code ("new" version) :


// init
if (lt_dlinit() != 0) 
   { fprintf(stderr,"%s\n", lt_dlerror()); exit(1); }

// open
lt_dlhandle libhandle = lt_dlopen(libDir + "/" +                                
tmpLibName);
if(!libhandle)  
   throw DynLibError(string("Error opening library ")
+               libName + ":\n  " +  lt_dlerror() );

cerr << libDir + "/" + tmpLibName << endl;
cerr << "1 : " << createFuncName.c_str() << endl;
typedef BaseInspector *(*CreateFunc)(const char *,              
Defaults *, InspectorHandler *);
cerr << libDir + "/" + tmpLibName << endl;
cerr << "1 : " << createFuncName.c_str() << endl;
lt_ptr ptr = lt_dlsym(libhandle,                                        
createFuncName.c_str());
const char * err = lt_dlerror();
cerr << "2 : " << ptr << endl;
 
if (!ptr || err)
  throw DynLibError(string("Error finding function ")
+      createFuncName + " in " + libName + ":  " + 
err);  

CreateFunc createfunc = (CreateFunc)ptr;


And this code says that :
Parsing "definitions/inspectorsDiskMono"
/.../lib/libDiskLoader.so
1 : createDiskLoaderMono
2 : 0x40043ef0
While parsing "definitions/inspectorsDiskMono" (line
3):
  Error finding function createDiskLoaderMono in
libDiskLoader.so:  unknown error
Parsing "definitions/inspectorsHpn"
/.../lib/libScaleInspector.so
1 : createScaleInspector
2 : 0x415b5710
While parsing "definitions/inspectorsHpn" (line 3):
  Error finding function createScaleInspector in
libScaleInspector.so:  unknown error
No definition files parsed - aborting


The pb is the "unknown error" when there is none !!
Here is the program not launched.


The old version was :

void *libhandle = dlopen((libDir + "/" + tmpLibName), 
                RTLD_NOW | RTLD_GLOBAL);
err = dlerror();
if( !libhandle )
     throw DynLibError(string("Error opening library
")              + libName + ":\n  " + err);

typedef BaseInspector *(*CreateFunc)(const char *,              
Defaults *, InspectorHandler *);
CreateFunc createfunc = (CreateFunc) 
             dlsym(libhandle, createFuncName.c_str());
err = dlerror();
if (err) 
   throw DynLibError(string("Error finding function ")
    + createFuncName + " in " + libName + ":  " +
err);



which said that :
Parsing "definitions/inspectorsDiskMono"
Parsing "definitions/inspectorsHpn"
While parsing "definitions/inspectorsHpn" (line 5):
  Error opening library libHpnInspector.so:
/home/bleher/qt-programming/LabFramework/lib/libHpnInspector.so:
undefined symbol:
__vt_23HpnTimeDelayBoxesWidget.12QPaintDevice

Here my application launch without the Hpn librarie


With my "new" version, I've also so tried :
...
lt_ptr ptr = lt_dlsym(libhandle,                        
createFuncName.c_str());
cerr << "2 : " << ptr << endl;
if (!ptr)
    throw DynLibError(string("Error finding function
")      + createFuncName + " in " + libName + ":  " +           
lt_dlerror());  
CreateFunc createfunc = (CreateFunc)ptr;

Which said that :
Parsing "definitions/inspectorsDiskMono"
/home/bleher/qt-programming/LabFramework/lib/libDiskLoader.so
1 : createDiskLoaderMono
2 : 0x40043ef0
Parsing "definitions/inspectorsHpn"
/home/bleher/qt-programming/LabFramework/lib/libScaleInspector.so
1 : createScaleInspector
2 : 0x415e3710
/home/bleher/qt-programming/LabFramework/lib/libHpnInspector.so
1 : createHpnInspector
Segmentation fault

And my program crash


The question is : how does I use lt_dlerror() that I
would read the same output as in dlerror() version ??


I've this pb only when there is an error in my
librairie. Here are the output when I use a "good"
librairie :

- old version - 
Parsing "definitions/inspectorsDiskMono"
Parsing "definitions/inspectorsContrast"

- new version (b) - 
Parsing "definitions/inspectorsDiskMono"
/home/bleher/qt-programming/LabFramework/lib/libDiskLoader.so
1 : createDiskLoaderMono
2 : 0x40043ef0
Parsing "definitions/inspectorsContrast"
/home/bleher/qt-programming/LabFramework/lib/libContrastInspector.so
1 : createContrastInspector
2 : 0x415e4f70

- new version (a) (with const char * err) -
Parsing "definitions/inspectorsDiskMono"
/home/bleher/qt-programming/LabFramework/lib/libDiskLoader.so
1 : createDiskLoaderMono
2 : 0x40043ef0
While parsing "definitions/inspectorsDiskMono" (line
3):
  Error finding function createDiskLoaderMono in
libDiskLoader.so:  unknown error
Parsing "definitions/inspectorsContrast"
/home/bleher/qt-programming/LabFramework/lib/libContrastInspector.so
1 : createContrastInspector
2 : 0x415b6f70
While parsing "definitions/inspectorsContrast" (line
3):
  Error finding function createContrastInspector in
libContrastInspector.so:  unknown error
No definition files parsed - aborting



In both cases, the program launch with the librairie,
but not in the last case.

I precise that I've read the all GNU libtool docu and
search in the download version of mailing list (the
6MB data), but I haven't found anything concerning my
problem. I've search in google and found similar mails
from others users but old (2000) and without solution.
The error may be in ltdl.c ??

Thanks for your help...

I repeat my question : how does I use lt_dlerror()
that I could read the same output as in dlerror()
version when an error (such as "symbol not found")
appear ?


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]