[fpc-devel] Manual reload of a DLL snapshot (with relocations) causes multiple AV
core at barvinok.net
Fri Jan 6 19:10:24 CET 2012
> > 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.
That's precisely what I was complaining about. Apparently it does NOT overwrite with new values and I want to know how to make sure it does so.
> Several APIs exist which allow to load the image without invoking its
> entrypoint. LoadLibraryEx, MapImage, etc. They vary in processing imports
> and relocations, though.
Irrelevant. I'm pretty comfortable with what LoadLibrary is supposed to do.
More information about the fpc-devel