On Monday, 25 January 2021 at 11:30:45 UTC, Vitalii wrote:
On Monday, 25 January 2021 at 10:26:20 UTC, frame wrote:
[...]

Yes. I'm doing it whet add dll.d (https://wiki.dlang.org/Win32_DLLs_in_D) in compile line, it contents:
---
import core.sys.windows.windows;
import core.sys.windows.dll;

__gshared HINSTANCE g_hInst;

extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
{
    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:
    }
    return true;
}
---

try replacing this with mixin SimpleDllMain (it initializes runtime for you IIRC). Runtime.LoadLibrary() is expected to call rt_init too, but Windows support for shared libs is too far from good.

Reply via email to