Quote Originally Posted by Sebastiani View Post
Maybe something like:

Code:
std::auto_ptr<myClass> myInstance;

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
            // attach to process
            // return FALSE to fail DLL load
            myInstance = std::auto_ptr<myClass>(new myClass(hinstDLL));
            break;
        case DLL_PROCESS_DETACH:
            // detach from process
            break;
        case DLL_THREAD_ATTACH:
            // attach to thread
            break;
        case DLL_THREAD_DETACH:
            // detach from thread
            break;
    }

    return TRUE; // successful
}
Thanks, just tried that but the same problem ocured. I've even tried using std:fstream in DllMain to write out some info but nothing happens :/

If I manually do myClass myinstance(getModuleHandle("myDll.dll")) it works as expected, but that obviously means the DLL can never be renamed.