[gmpi] Re: Linux C++ question

>You want to unload a DLL.  You've called ::Release() for all Plugin
>instances (thereby destructing them).  You call ::Release() for the
>Factory instance.  You are then allowed to unload the DLL.
>
>Unloading the DLL without calling ::Release() on every object from that
>DLL is a logic bug.  The same as you would not deref a pointer after
>free(), you don't want to do ANYTHING with a DLL after you unload it.

this brings up a general issue with all object systems. do you, or do
you not, provide a "going away" notification to interested parties. 

for example, suppose you want to just unload the DLL very simply. you
could just call the DLL's unload function, which could ::Release()
every current instance of the plugins from the DLL. each ::Release()
could tell any interested parties that the plugin instance is
vanishing, and they can clean up.

the more "C" way of doing this is closer to what you propose: the host
has to track every instance, and ::Release() them. the problem is that
when there are multiple ways to cause resources to become deallocated,
assuming the use of just one those ways is a possible source of
danger.

i don't know of any clean way to do this in a C interface. the GObject
system is close, but its hardly "clean".

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