Request assistance initializing struct instance at global scope

Andrew Edwards edwards.ac at gmail.com
Tue Dec 8 01:47:51 UTC 2020


On 12/7/20 10:12 PM, Jacob Carlborg wrote:
> On Monday, 7 December 2020 at 04:13:16 UTC, Andrew Edwards wrote:
> 
> You can either use `extern(C) char*[] hldr` to make only `hldr` have C 
> linkage. Use `extern(C) {}` to group several symbols which should have C 
> linkage or rearrange the code so that `static this` is above `extern(C):`.
> 
> -- 
> /Jacob Carlborg

Thanks Jacob. The extern(C) is temporary. I'm doing a direct port of the 
code to D using -betterC. Wanted to keep it as close to the original as 
possible until everything compiles.

I noticed that static this() does not work if either it or main() (or 
both) is marked extern(C). To fix the issue, I simply moved the static 
this() and main() above the extern(C) and the deprecation error disappears.

Andrew


More information about the Digitalmars-d-learn mailing list