Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with libltdl



Hello,

I am porting Satom (http://savannah.nongnu.org/projects/satom) to Mac OS X platform. I didn't have any troubles in compiling my project (thanks to Automake/Autoconf). I have a problem at run time with the set of functions lt_dlopen, lt_dlsym, lt_dlerror, lt_dlclose (from the library libltdl). Satom needs to load multiple libraries that defines the same symbol.

I use two libraries to do my testing: stutils and test02. Both libraries
define the symbol _st_factory_create_class as shown with nm:
$ nm libstutils.dylib | grep st_factory_create_class
00000b70 T _st_factory_create_class
000547f0 S st_factory_create_class.eh
$ nm libtest02.dylib | grep st_factory_create_class
00001780 T _st_factory_create_class
0004613c S st_factory_create_class.eh

When I open the libraries and query for the symbol
st_factory_create_class, it works fine for the first library and doesn't
work for the second library opened. So, the following piece of code:
 lt_dlhandle handle = lt_dlopen(filename);
 if (handle == 0)
   {
     std::cerr << "error: " << lt_dlerror();
   }
 std::cout << filename << " (" << handle << ")" << std::endl;
 void* fun = lt_dlsym(handle, "st_factory_create_class");
 if (fun == 0)
   {
     std::cerr << "error: " << lt_dlerror();
   }
 else
   {
     std::cout << "fun: " << fun;
   }
 lt_dlclose(handle);
 std::cout << std::endl;

prints the following output:
/Users/thomas/Documents/Applications/satom/lib/libstutils.dylib (0x300220)
fun: 0x1008b70
/Users/thomas/Documents/Applications/satom/lib/libtest02.dylib (0x300390)
error: dlcompat: Symbol "_st_factory_create_class" not found

As, you can see, it works well for the first library loaded but never
for the second. Any hint to explain/solve this problem will be greatly
appreciate.


Thank you very much, Best regards,

Thomas


_______________________________________________ Do not post admin requests to the list. They will be ignored. Unix-porting mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.