On Friday, 19 April 2013 at 00:53:28 UTC, Vladimir Panteleev wrote:
On Friday, 19 April 2013 at 00:24:27 UTC, Trey Brisbane wrote:
As you can see, there appears to be an issue with my usage of WinMain() as opposed to just main(). For 32bit building, the documentation states that the compiler recognizes WinMain and works accordingly - is this also the case for 64bit building?

The entry point for DLLs is the DllMain function, not WinMain. I'm not sure why building a DLL with a WinMain entry point would succeed - I'd assume the resulting DLL wouldn't work.

In the future, consider posting questions on how to use D to the digitalmars.D.learn group.

You're completely right. It seems I copy+pasted from the wrong source file by mistake.

My DLLMain (not WinMain) is as follows:

-------------------------------------------------------------------

extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) {
        // Main DLL switch
        switch (ulReason) {
                case DLL_PROCESS_ATTACH:
                        g_hInst = hInstance;
                        dll_process_attach( hInstance, true );
                        break;
                case DLL_PROCESS_DETACH:
                        dll_process_detach( hInstance, true );
                        break;
                case DLL_THREAD_ATTACH:
                        dll_thread_attach( true, true );
                        break;
                case DLL_THREAD_DETACH:
                        dll_thread_detach( true, true );
                        break;
                default:
                        break;
        }
        return true;
}

-------------------------------------------------------------------

With regards to digitalmars.D.learn - I had considered posting there, but considering this isn't really a question about learning D, but rather about getting an existing D project to build, I decided against it. If that is however the preferred location for such a question, I will post there next time as you suggested. :)

Reply via email to