Re: Xcode 2.3 breaks bundle static object destruction? fuse-cxa-atexit? Help!
Re: Xcode 2.3 breaks bundle static object destruction? fuse-cxa-atexit? Help!
- Subject: Re: Xcode 2.3 breaks bundle static object destruction? fuse-cxa-atexit? Help!
- From: "Andy O'Meara" <email@hidden>
- Date: Sat, 10 Jun 2006 15:48:49 -0400
- Thread-topic: Xcode 2.3 breaks bundle static object destruction? fuse-cxa-atexit? Help!
Well, I don't understand why, in Mac OS X, ya developer would ever want a
dynamic library's static deinit chain to be put in the host process's deinit
chain. In Windows, for example, a dynamic library's static init chain
always occurs when a it's loaded (LoadLibrary()) and the its deinit chain is
*always* called when the module is unloaded (FreeLibrary()) (where
LoadLibrary() and FreeLibrary() are the Windows analogs to CFBundleCreate()
and CFRelease()). So the fact that the default behavior for a dynamic
library to do its static deinit on the host process's static deinit chain
leaves me totally baffled--I keep thinking that I must have a gross
conceptual error regarding Mac OS X dynamic libraries.
In any case, I'm just glad James thought to try -fno-use-cxo-atexit
(although I'm still not sure what's going on behind the scenes). Oh, also,
I thought I'd mention that I don't use any __attribute__ stuff anywhere in
our codebose.
Andy
On 6/10/06 2:34 PM, "Allen Cronce" <email@hidden> wrote:
> I would have thought that relying on atexit for cleanup of a
> non-application executable could result in undefined behavior. Because
> you really don't have control over when your bundle is unloaded.
>
> Shouldn't you use a module termination proc or "__attribute__
> ((destructor))" instead?
>
> Note that if ordered construction/destruction is important, you can use
> the init_priority attribute:
>
> http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/gcc/C_002b_0
> 02b-Attributes.html
>
> Best,
> --
> Allen Cronce
>
> James W. Walker wrote:
>>
>> On Jun 10, 2006, at 7:03 AM, Andy O'Meara wrote:
>>
>>> I'm happy to report that adding -fno-use-cxo-atexit to my bundle project
>>> made the problem go away as well. Great work, James!
>>
>> Cool.
>>
>> One other thing I'd like to add to this thread: If an unloadable
>> bundle calls atexit(), then there will be a crash on quit under
>> Panther regardless of whether -fno-use-cxo-atexit or -fuse-cxo-atexit
>> is used.
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Xcode-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>>
>> This email sent to email@hidden
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden