On Monday, 24 January 2022 at 19:41:30 UTC, frame wrote:
It claims that the D calling convention matches C. But it seems that the arguments are pushed in order whereas C does it in reverse order and the -218697648 value is indeed my 3rd string pointer.

Windows has two calling conventions for C functions, `cdecl` and `stdcall`. In D, `cdecl` is called `extern (C)` and `stdcall` is called `extern (Windows)`. Windows API functions use the `stdcall` convention [1], so you need to use `extern (Windows)` when calling them from D.

[1] https://docs.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170

Reply via email to