[gmpi] Re: Linux C++ question

regarding static file-scoped variables:

if a plugin needs stuff like that, it needs to be put into the entry
point that the platform will execute on object load.

i know that on linux, this is done automatically by the linker at link
time: if you declare an static file-scoped object, then its
constructor will be called in the "_init" function created by the
linker. result: by the time any host sees the plugin and before any
plugin code (as written by the developer) is executed, the constructor
has been called.

again, i believe similar mechanisms exist for other platforms.

note that it is obviously very bad practice for a shared object to try
to define its own _init and _fini style functions if it also contains
static file-scoped variables.

--p

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

Other related posts: