I am trying to load a .dll
file and have it display a message box when loaded. From my understanding, once a .dll
is loaded, it makes a call to
In addition to the blog post Greg links to there are several other informative posts about the loader lock and things you should not do in DllMain.
In general you should only call functions in kernel32 that don't create threads/windows, use COM or calls LoadLibrary (or other functions involving the loader lock).
A reasonable list of safe things IMHO would be: DisableThreadLibraryCalls, Tls*, InitializeCriticalSection and in your case (for debugging purposes); OutputDebugString