Error: Global variable type does not match previous declaration with same mangled name:

Johan Engelen j at j.nl
Mon Nov 23 11:52:44 UTC 2020


On Sunday, 22 November 2020 at 19:53:51 UTC, kinke wrote:
> On Sunday, 22 November 2020 at 17:46:16 UTC, Adam D. Ruppe 
> wrote:
>> pragma(mangle, "_D" ~ T.mangleof[1..$] ~ "6__initZ")
>> // llvm says it is supposed to be { [2 x i8*]*, i8* }       
>> __gshared extern immutable idk initializer;
>
> Yeah, this trick only works for (non-zero-initialized) structs.

Hi Adam,
   Keep us posted about your progress. I've also worked on this a 
few months ago, to fix the druntime implementation of emplace 
that stack allocates large structs.
Current fix in production: 
https://github.com/weka-io/druntime/blob/134bdb9a02ffec5370c5788b61fe692ae441d9c5/src/core/internal/lifetime.d#L113-L146

Here is my attempt at avoiding the duplication of the symbol:
https://github.com/weka-io/druntime/blob/185ef32d69eb0024eec5a698e03cbbeade2e2ca7/src/core/internal/lifetime.d#L92-L140
For classes, I have no solution either...

-Johan







More information about the digitalmars-d-ldc mailing list