Extern C and Symbol Mangling

Stanislav Blinov via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 26 05:51:20 PDT 2017


On Friday, 26 May 2017 at 12:49:27 UTC, Oleksii wrote:
> Hi,
>
> I'm trying to link against a DLL which exports a bunch of C 
> functions. The issue is: C symbols do not have underscore 
> prefix in Windows, but DMD sticks underscore in front of the 
> symbol name. For example: `extern(C) void Foo()` becomes `_Foo`.
>
> Is there a way to disable that underscore?


Use extern(Windows), or the more general extern(System), which 
will expand to either extern(C) or extern(Windows), depending on 
the OS you target.


More information about the Digitalmars-d-learn mailing list