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

DanielG simpletangent at gmail.com
Mon Oct 29 00:12:43 UTC 2018


On Monday, 29 October 2018 at 00:04:54 UTC, Adam D. Ruppe wrote:
> Both are listed as extern, where is the actual variable stored? 
> If it is in the dll, it shouldn't be extern there.

It's defined in the .cpp file. This is how the built-in DLL 
template generates it - "extern" in the .h file, actual 
definition in the .cpp file.

If you don't have "extern" there, anybody who #includes that .h 
file would inadvertently have the variable defined, which would 
result in duplicates (and won't compile).



More information about the Digitalmars-d-learn mailing list