[cfe-dev] ObjectiveC on Windows using the Apple Obj C runtime
devlists at shadowlab.org
Thu Jan 21 15:02:11 PST 2010
Le 21 janv. 2010 à 22:06, Jim Crafton a écrit :
>>> 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.
The current Apple's objc runtime is maybe better than the old GNU one, but I don't think it will give you more than the GNU objc2 runtime but troubles.
Trying to use the Apple runtime outside of the Apple world is not recommended and not supported at all. The ObjC runtime is Open source but it heavily relies on Foundation to set it up.
Without the Apple's Foundation, critical part of the runtime will not work properly.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev