Hi Mathias,

Mathias Bauer wrote:
Kay Ramme - Sun Germany - Hamburg wrote:

Hi Mathias, Caolan,

IMHO right approach for _all_ library (de-)initialization is to use the library c'tors / d'tors (AKA _init / _exit, DLLMAIN etc.). This would also avoid the problems we are every once a while facing regarding shutdown ...

When will they be called? I assume when the library is unloaded by the
Actually the library d'tors are called before unloading.
system. This would be far too late for the code we call in the Exit()
methods.
Why? At least not in principle.

From former times we still have this "some things must be available all
the time" approach that still hurts us here. The code called in the
Exit() method relies on being able to execute any code in the
corresponding DLL and this OTOH might access objects that already have
been destroyed when the library gets unloaded.
If a library is unloaded, you can not call it anyway. But the library d'tor only gets called immediately before unloading the library, the moment the libraries ref-count drops to zero. So, if your library is linked against another library, it is _guaranteed_, that the d'tor of your library gets called before the other one.

As I wrote already, every deinit scenarios based on low level operations
may work fine with libraries not being bound to a large C++ framework,
but not for libraries like sw, sd and so on.
I believe there are pitfalls with sw, sd etc.

I agree that this would be desirable - but until then it's a long way to
go and some other more important stations on this way need to be visited
first.
I actually did not say that this approach needs to be applied immediately, or at all. Just wanted to make you aware of it. AFAIK it is a proven approach and makes life for developers easier ... yes, I know, that is not necessarily what we want ;-)

Perhaps I should join the currently ongoing "talk about your visions"
fashion to explain my roadmap on this way. ;-)
Just go ahead, what's your roadmap vision etc.?

Ciao,
Mathias


Best regards


      Kay

--
Sun Microsystems GmbH           Kay Ramme
Sachsenfeld 4                   Senior Technical Architect
20097 Hamburg                   Phone: (+49 40) 23646 982
Germany                         Fax:   (+49 40) 23646 550
http://www.sun.com/staroffice   mailto:[EMAIL PROTECTED]
http://www.sun.com/openoffice
http://udk.openoffice.org
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Bömer
Vorsitzender des Aufsichtsrates: Martin Häring

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to