3 Mar 2007 22:59
Re: DLL startup
Knut St. Osmundsen <bird <at> anduin.net>
2007-03-03 21:59:06 GMT
2007-03-03 21:59:06 GMT
James Moe wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello, > I changed the library code of a module to use the DLL instead of a > static library. Specifically I am using OpenSSL: <ssl.dll> and > <crypto.dll>. The DLLs are not necessarily in LIBPATH. If you don't use dlopen / DosLoadModule and dlsym / DosQueryProcAddr all the DLLs has to be in the *LIBPATHs. That's the way the loader works. > The program has code to load the DLLs during initialization. But the > program now refuses to start because it cannot find SSL. There appears to > be some runtime startup code that is executed before main() is entered. Yes, most DLLs has a DLL_InitTerm entrypoint that's executed after they've been loaded to initialized the CRT and other things. All this has to be executed before main(). The same goes for static initializers (global objects and such like in C++). That's part of how the DLLs and EXE works. > The startup ignores BEGINLIBPATH. No, it doesn't. Statically linked DLLs dependencies are resolved before any code is executed in the process by the OS/2 kernel. > Is that startup added by the compiler? If so, is there a way to prevent > it from running?(Continue reading)
RSS Feed