On 21 May 2017 at 23:00, Guy Harris <[email protected]> wrote:

> On May 21, 2017, at 2:54 PM, Graham Bloice <[email protected]>
> wrote:
>
> > It would appear not in a static initializer list. I can do it piecemeal,
> e.g. foo.member = &fff.
>
> Does "piecemeal" really mean "in executable code"?
>

Keyboard error with my last.  From dlltest2.zip, dllimport.c:

int getData(void)
{
  /* Piecemeal assignment of static struct */
  myStruct.data = myData;
  myStruct.ptrData = &myData;
  return *(myStruct.ptrData);
}

where myData is the value exported by dllexport, and imported by dllimport.


>
> > If I try to assign &fff in an initialiser list I get an "error C2099:
> initializer is not a constant".
>
> If you're initializing a static variable, that's probably not done in
> executable code.
>
> The difference may be that the compiler can generate the appropriate
> machine code to calculate the address of fff, but can't generate the right
> object-file indications to the linker and run-time loader to get *them* to
> do it - and if the variable being initialized is const, that might not work
> as it might be mapped read-only.
>
>
-- 
Graham Bloice
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to