[cfe-dev] Rewrite Objective-C to C

Chris Lattner clattner at apple.com
Mon Nov 10 08:27:26 PST 2008


On Nov 10, 2008, at 6:41 AM, Dado Colussi wrote:
> I am new to this list, and my inexperience in compiler technology is
> likely to shine in my questions. Here we go...
>
> I am interested in trying to use clang to convert Objective-C code to
> C, and compiling the generated C code with 3rd party compiler. I have
> managed to convert and compile a very simple hello application on my
> Mac using Apple's runtime after having tweaked the generated code. I
> have failed with anything more complex than the hello in one file.
>
> I wonder:
> * How realistic and feasible my approach is?
> * How mature the rewrite code in clang is?
> * Is there enough community interest to actually make the rewrite code
> complete?

Hi Dado,

This is realistic, but you will need to translate all the runtime  
libraries and headers also.  The Objective-C rewriter only "lowers"  
ObjC to C, it doesn't turn (for example) Cocoa calls into MFC calls or  
something like that.  To use it in practice, you need to be able to  
run the code for the frameworks you use through it to.  If you're  
using GNUStep or something like that, it should be possible in theory.

-Chris 



More information about the cfe-dev mailing list