[gmpi] Re: Linux C++ question

  • From: Jeff McClintock <jeffmcc@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Thu, 03 Mar 2005 09:31:41 +1300

> Bearing in mind that OS X is a big part of the commercial plug-in
> market, and that XCode (Apple's visual IDE for GCC) is probably the most
> popular compiler on OS X now, it's important to support it.

Yep, agree 100%.
I guess I'm just dissapointed about the restriction. We can survive without static objects.


Best Regards,
jeff

Angus F. Hewlett wrote:
Jeff McClintock wrote:

i wasn't trying to show the whole thing. but your reply makes the
point i was trying to make anyway :) yes, a singleton needs to cleanup
at exit. what is "at exit"? we want it to be DLL-unload time, but can
the language ensure that this happens with a static object? the C++
working group discussion suggests that it can. however, angus has
described how OS X still has a problem in fulfilling this.



I understand GNU fixed this bug 3 years ago. If OSX doesn't support fundamental keywords like 'static' I'll eat my cat.


OS X supports the "static" keyword, yes.

The problem is that a static object has to be constructed and destroyed... atexit is part of the invisible machinery that does this (there are equivalent routines on Windows). This works correctly in OS X GCC applications, correctly in OS X dylibs for file-scope / global-scope statics, but is broken for OS X GCC dylibs for function-scope statics.

The constructors get called at the right time - at module-load. That's all well and good. The problem is, the destructors get called at application-exit, NOT at module-unload. If the module was already unloaded -- kaboom, your application crashes on quit, as atexit calls off in to space.

Bearing in mind that OS X is a big part of the commercial plug-in market, and that XCode (Apple's visual IDE for GCC) is probably the most popular compiler on OS X now, it's important to support it.



----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe




----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: