[gmpi] Re: Linux C++ question

  • From: Jeff McClintock <jeffmcc@xxxxxxxxxx>
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Thu, 24 Feb 2005 17:39:32 +1300

> I'm fine with the new/delete approach (don't use a static object). It
> is minor overhead, minor complexity, and enables my old Cobalt to use as a testbed :)


OK, Just make a note.

"No GMPI Plugin may use the static keyword on any Object".

Jeff

Tim Hockin wrote:
On Wed, Feb 23, 2005 at 09:53:16PM -0500, Paul Davis wrote:

On Thu, Feb 24, 2005 at 03:14:21PM +1300, Jeff McClintock wrote:

`-fuse-cxa-atexit'
    Register destructors for objects with static storage duration with
    the `__cxa_atexit' function rather than the `atexit' function.
    This option is required for fully standards-compliant handling of
    static destructors, but will only work if your C library supports
    `__cxa_atexit'.

Would be nice to have standard-complient code.

Sorry, update: I found a small doc for it. What's not clear is what to do if it is NOT supported?

plugins should not use atexit(). period.


The code is not using atexit().  The compiler is using atexit() to call
the static objects destructor.

This is a bug, and has been fixed by the creation of __cxa_atexit()
which runs at dll unload time.


each platform that supports shared objects/runtime linkage has its own
rules about what happens when the shared object is "unlinked". on
linux, if there is an entry point called "_fini" in the object, it
will be executed. similar conventions exist for win32 and cocoa/darwin.


I'd rather avoid reliance on platform-isms as much as possible.

The question is not whether we should use atexit or not, the question is
whether we should jump through a (very minor) hoop to allow the plugin
base class to run on older GNU installations (those that pre-date
__cxa_atexit()).

I'm fine with the new/delete approach (don't use a static object).  It
is minor overhead, minor complexity, and enables my old Cobalt to use as
a testbed :)

I'd also be fine saying that a GMPI platform must support the ability to
load and unload dlls with static objects.  This may require compiler
flags for people building plugins.  (and it means my RH8 era Cobalt is out
of the game as a GMPI platform)

Tim

----------------------------------------------------------------------
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: