Now I know what the problem is. In D, module variables are by
default in TLS (thread local storage). To make it refer to a
global C variable, use __gshared:
extern (C) extern __gshared NSString
Sorry, I completely forgot about that.
Ha, awesome! It works! I'll add this to a wiki page in the
DiveFramework github repos.
Oh, and btw, I was briefly looking into the DMD source for trying
to fix myself the issue with the protocol to class instance cast
(trying to be useful), but I am seriously completely not hardcore
enough of digging anything in there, lol. Anyhow, if you got a
hint, let me know. It's not just in the example discussed in my
other posts, I found it to be an issue in other places as well,
as often framework classes return id / ObjcObject instead of a
further typed instance. I don't remember where exactly I had a
problem, but I remember I used NSObject instead of ObjcObject in
these places, which of course is not the way to go.
Have a nice weekend!