Hi,
I've been working on a secret Clang-based project for a while, and now
I'm ready to share it with the world.
Introducing the "Deobjectivizer".
This is a program that scans framework bundle headers for Objective-C
constructs, and generates procedural C wrappers around them, so you can
call them from C. It uses Clang's libraries to parse, analyze, and
rewrite Objective-C headers into pure C headers, and then generate
corresponding source files containing the wrapper implementations. The
implementation of this tool is a little hackish at the moment, but it
suffices to generate a wrapper around the entire Foundation framework
(at least).
Using this program, developers no longer have to use Objective-C to
develop for Cocoa*. Projects like Wine that don't allow Objective-C can
use Cocoa anyway. iOS developers can write their programs in a language
other than Objective-C.
I've attached the source so you can play with my newest creation. At the
moment, it can only be built on Mac OS X (only one of two platforms, the
other being iOS, where a program like this makes sense anyway). Feel
free to make changes; the sources are licensed under the same license as
Clang itself.
Comments welcome. What do you think?
Chip
deobjectivizer.tar.gz (26.9 KB)