[gmpi] Re: Linux C++ question
- From: Tim Hockin <thockin@xxxxxxxxxx>
- To: gmpi@xxxxxxxxxxxxx
- Date: Thu, 3 Mar 2005 19:56:08 -0800
So, I can confirm that file-scope static objects work on my old GCC, but
function-scope statics do not. I tried the atexit() hack, and it doesn't
seem to work, though it does fill the atexit symbol which was unresolved
before. So it *should* work. Will investigate more.
So the new guideline should be that function and block scoped static
objects may break on some platforms.
On Wed, Mar 02, 2005 at 11:36:28AM +0000, Angus F. Hewlett wrote:
> Tim Hockin wrote:
>
> >On Wed, Mar 02, 2005 at 09:05:30AM +0000, Angus F. Hewlett wrote:
> >
> >
> >>(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.
> >>
> >>
> >Does anyone know or have access to Mac people who would know if this is
> >going to be fixed in GCC, or if there is a workaround?
> >
> >
> OK, I found a workaround, praise be to Google:-
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> 3) Related to the last question, in a search of this archive I found
> reports that there's a GCC bug where in dynamically loaded modules,
> static objects that are within a function or block scope do not have
> their destructors called correctly. It appears that instead these go
> to a call to _atexit, which is supposed to be for applications (not
> shared libs). I'm wondering if this has been fixed in the GCC 3.3
> update? If not, is there any workaround short of ensuring that all
> static objects are not within a function or block scope (a real pain
> to change in my current codebase)? Could I hack something like
> defining my own _atexit() function within my shared lib, which then
> calls _OSRuntimeFinalizeCPP(), or something ugly like that??
>
>
> This is certainly an annoying bug, but it isn't too hard to workaround.
> What we did was to realize that we could link in a '*atexit*'
> implementation to our bundle that would get linked to instead of the one
> from the system library.
>
> You should be able to just add this file to your bundle/shared library
> project and hopefully it will start working better.
>
> <http://www.omnigroup.com/~bungi/OGPBundleAtUnload.cpp
> <http://www.omnigroup.com/%7Ebungi/OGPBundleAtUnload.cpp>>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> Took me a bit of headscratching to figure out how this works (how is
> their static object able to manage others..?) - the clever bit is that
> their object is already taking advantage of the overridden atexit mechanism.
>
> With this in place, statics should be OK again on OS X.
>
> Cheers,
> Angus.
>
> --
> =========================================================
> Angus F. Hewlett, Managing Director (CEO)
> FXpansion Audio UK Ltd - http://www.fxpansion.com
> Registered in the UK - #4455834 - VAT: GB 798 7782 33
> =========================================================
>
>
> ----------------------------------------------------------------------
> 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: http://www.freelists.org/archives/gmpi
> Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
--
Tim Hockin
thockin@xxxxxxxxxx
Soon anyone who's not on the World Wide Web will qualify for a government
subsidy for the home-pageless.
----------------------------------------------------------------------
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: http://www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe
- References:
- [gmpi] Re: Linux C++ question
- From: Paul Davis
- [gmpi] Re: Linux C++ question
- From: Jeff McClintock
- [gmpi] Re: Linux C++ question
- From: Angus F. Hewlett
- [gmpi] Re: Linux C++ question
- From: Tim Hockin
- [gmpi] Re: Linux C++ question
- From: Angus F. Hewlett
Other related posts:
- » [gmpi] Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- » [gmpi] Re: Linux C++ question
- [gmpi] Re: Linux C++ question
- From: Paul Davis
- [gmpi] Re: Linux C++ question
- From: Jeff McClintock
- [gmpi] Re: Linux C++ question
- From: Angus F. Hewlett
- [gmpi] Re: Linux C++ question
- From: Tim Hockin
- [gmpi] Re: Linux C++ question
- From: Angus F. Hewlett