Mailing Lists: Apple Mailing Lists

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

dlopen() on 10.3 and static initializers



I’m in the process of qualifying my app on 10.3.


My app uses dlopen() to load some libraries, which contain a number of static objects that register themselves to the app in their constructors.

While this works fine in 10.4, on 10.3 these registrations never occur.  There are no errors loading the libraries, but it seems that no C++ static object constructors are being called.


Looking on the web I’ve found these links:

http://darwinsource.opendarwin.org/10.3/iodbc-19/dlcompat-20010831/README

http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/DynamicLibraryUsageGuidelines.html

 

which strongly indicate problems with static initializer calling and dlopen().  But I didn’t find anything saying that these things were fixed in 10.4, and they obviously are.


So what to do?  Perhaps I can, in 10.3 only code, create a module initializer and finalizer with the __attribute__((constructor)) and __attribute__((destructor)) that call to the proper C++ static initailizer and destructor, but it isn’t entirely clear how to do this or if it would work.  I note there are a number of

__static_initialization_and_destruction_0(int,int)

lines in the output of nm on my library (with the ‘s’ tag), but that isn’t enough for me to go on.


Does anyone have any experience with this issue?


Thanks,


David Litwin

BigFix

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/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.