DIP45: fixing the dllimport/dllexport issue

Martin Nowak code at dawg.eu
Thu Sep 5 18:51:54 PDT 2013


On 09/01/2013 05:26 PM, Rainer Schuetze wrote:
>
> Maybe already deep into implementation but how are we going to deal with
> the initialization of data?
>
> module sharedlib;
> __gshared int var;
>
> module exe;
> import sharedlib;
> __gshared int* pvar = &var;
>
> (This kind of relocation also has to be done for stuff like
> TypeInfo_Class). It needs initialization code to fill pvar with the
> correct pointer.
>
Based on your saying that there are no absolute data relocations for 
this on windows we'd have to perform runtime initialization.
At runtime it would simply copy _imp_var into pvar, right?

> Do we support the same for pointers in TLS?
>
> int* tlsvar = &var;
>
> This might need initialization per thread, or patching the original TLS
> segment.
No you can't take the address of a TLS var at compile time.


More information about the Digitalmars-d mailing list