user377628
user377628

Reputation:

Can clang or gcc convert Objective C code into plain C?

I'd like to convert Objective C code into plain C. I can do this by hand rather easily. For example this Objective C code:

[object method];

could be converted to something like:

SEL method = sel_registerName("method");
objc_msgSend(object, method);

However this is kind of tedious, especially for larger files. It seems clang should be able to generate this C code pretty easily. Is there a way I can convince it to do so?

Upvotes: 1

Views: 658

Answers (1)

Greg Parker
Greg Parker

Reputation: 8012

Short answer: No.

Longer answer: clang supports -rewrite-objc, but you are almost certainly not going to like the results.

Upvotes: 5

Related Questions