06.01.2012 18:07, Gennadiy Poryev пишет:
= Preamble =

First, I'd like to know why calling of DLL entry point anew does not 
re-initialize _all_ RTL
internals regardless of what was remembered prior to taking the snapshot. Is it 
just assuming good
behavior of system loader that carefully zeroes data segment while I don't?

The data segment is not necessarily zeroed, it can contain non-zero initial values. Once you load DLL using LoadLibrary and let its entrypoint run, it will overwrite initialized part with new values and there is no way to recover the original values.
In particular, tlsindex global variable is initalized with value of -1, not 0.

Several APIs exist which allow to load the image without invoking its entrypoint. LoadLibraryEx, MapImage, etc. They vary in processing imports and relocations, though.

Regards,
Sergei
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to