[cfe-dev] ObjectiveC on Windows using the Apple Obj C runtime
jim.crafton at gmail.com
Thu Jan 21 15:06:34 CST 2010
>> Thanks! do I use "-fnext-runtime" when I compile with clang or when I use lli?
> It needs to be when you run clang. You almost certainly won't be able to use the resulting code with lli though. lli interprets the bitcode. The NeXT runtime uses special segment types to register Objective-C structures. The segment types and the loader callbacks do not exist in interpreted or JIT-compiled code, so the runtime does not have any way of getting at them. The interaction between the loader and the NeXT runtime is quite complex. In contrast, the GNU runtime just expects __objc_exec_class() to be called once per compilation unit, which is done via the same mechanism C++ uses for static initalisers and gcc uses for __attribute__((constructor)) functions in C.
> If you want to JIT compile or interpret Objective-C code for the NeXT runtime then you will need to make calls to objc_allocateClassPair() and so on in your own code.
> Is there a sensible reason why you chose to use the NeXT runtime, by the way?
Actually all I really want, ideally, is to be able to use clang/llvm
to generate an exe or dll based on ObjectiveC. I'd rather not use the
GNU runtime, especially since the Apple one is publicly available, and
I'm guessing it's better than the GNU one, plus as a general rule I
try to avoid any of the GNU stuff for windows related programming. I
don't care about using Cocoa per se, I'd be perfectly happy with just
the basic Objective C runtime.
More information about the cfe-dev