betterC DLL in Windows
km212121 at gmail.com
Sat Feb 4 18:29:41 UTC 2023
On Saturday, 4 February 2023 at 16:51:36 UTC, Richard (Rikki)
Andrew Cattermole wrote:
> You don't have access to druntime/Phobos stuff at runtime.
> SimpleDllMain is for initializing and uninitializing druntime.
> You want to only use ldc atm. The defaults right now should
> most likely "just work" in dub for a single compile + link step
> (i.e. only a single static library in dll).
> If you do it manually, you'll want to add the flag
> ``--fvisibility=public`` to export everything.
I'm not sure I understand every bit of it yet, but this looks
helpful, thank you.
I was able to compile this (based on dllmain.d linked by you)
with both DMD and LDC:
import core.sys.windows.windef : HINSTANCE, BOOL, DWORD,
extern (Windows) BOOL DllMain(HINSTANCE hInstance, DWORD
ulReason, LPVOID reserved)
export extern (C) void foo()
import core.stdc.stdio : printf;
What's the reason to prefer LDC over DMD?
More information about the Digitalmars-d-learn