Kay Ramme - Sun Germany - Hamburg wrote:

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

Not linked against - it's different. As an example, many Writer code
will fail if the desktop service or some others have been destroyed
already. Where's the guarantee that the desktop will still exist when
the Writer dll gets unloaded? When will it be unloaded at all?

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

Yes, if makes sense to do that when you plan for it from the ground up.

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

This will take some time ...

Sometime in future at GullFOSS!

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.

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

Reply via email to