struggling to link against a C global in D (win/vs2017)

kinke noone at nowhere.com
Mon Oct 29 00:52:32 UTC 2018


On Monday, 29 October 2018 at 00:01:21 UTC, DanielG wrote:
> [...]

I'd examine the dumpbin output of your (native) import library, 
e.g., `dumpbin /symbols blub.lib`. You can also list exports etc. 
The names it spits out are undecorated, i.e., C symbols for Win32 
libs will feature the implicit _ prefix.

A C global in D on Win32 will always get the _ prefix, incl. 
names overridden via pragma(mangle, 'name') (=> _name). You can 
cheat by declaring it as `extern(C++)`, where there's no _ prefix.

On Win64, there shouldn't be any name decoration for C symbols 
though.


More information about the Digitalmars-d-learn mailing list