[cfe-dev] ObjectiveC on Windows using the Apple Obj C runtime

Chris Lattner clattner at apple.com
Thu Jan 21 10:31:36 PST 2010


On Jan 21, 2010, at 10:28 AM, Jim Crafton wrote:

>
> Not surprising, it doesn't know where the runtime is. Apple provides
> the source, plus Visual Studio projects, for their objcrt, and after a
> few tweaks I was able to build it successfully, and ended up with
> objc.dll, and a whole bunch of runtime functions.
>
> Now my question is: how do I get LLVM to use this? I'm not interested
> in Cocoa whatsoever, I'd just be curious to use bare bones objective
> C, and even build my own framework if I get really ambitious. I notice
> that there are two files in clang, CGObjCGNU.cpp, and CGObjCMac.cpp -
> would I need something like CGObjCWin32.cpp that implements the
> appropriate code? Is there something else involved? Has anyone else
> tried this, or even interested in this?

It depends on what you're trying to do.  If you're trying to JIT code,  
you can load it with the 'lli -load foo.dll' command line option.   
However, LLI doesn't know enough about objc metadata to register the  
classes etc with the runtime, so you'd have to add this.

If you want to statically compile code, just linking to the dll you  
built should be enough.  I'm not an objc or windows guru though.

-Chris



More information about the cfe-dev mailing list