Graham Fawcett wrote:
On Sun, 18 Apr 2010 19:14:33 +0200, Lars T. Kyllingstad wrote:
Graham Fawcett wrote:
Hi folks,
I'm having trouble reading an external(C) global value in D2. I think
I'm using __gshared properly to sidestep the TLS issues, but I'm still
getting an incorrect result.
[...]
Am I doing something wrong?
Thanks,
Graham
Try adding a second 'extern':
extern(C) extern __gshared char* gdbm_version;
That did it! Thank you. I have much to learn.
No problem. :) I ran into the same issue myself a few weeks ago, and it
took a while before I figured it out. I believe the explanation is that
- 'extern(C)' means that it is a C variable, i.e. its name isn't
mangled like a D variable in the object file.
- 'extern' means that it's not a part of the current module, and
has to be linked in from elsewhere.
-Lars