Shutdown Handling: DLL & Shared Object Detachment?

Sergey Gromov snake.scaly at gmail.com
Mon Sep 1 17:01:20 PDT 2008


Benji Smith <dlanguage at benjismith.net> wrote:
> Sergey Gromov wrote:
> > The problem is, if DETACH is called because a process terminates, the 
> > order of uninitializing process DLLs is unknown, not unlike the order of 
> > collecting objects by GC is unknown. It may happen that sockets library 
> > is already uninitialized. Basically you cannot do anything sophisticated 
> > in DllMain which is discussed in the above article.
> 
> That's good to know. I'll avoid anything fancy in my detach handler. I 
> assume file IO is safe?

The file I/O is in kernel32.dll which is guaranteed to be present at all 
times. Taking into account that D uses statically-linked runtime, I 
think yes, file I/O should be safe.

-- 
SnakE


More information about the Digitalmars-d-learn mailing list