-rewrite-objc and Objective-C in clang

我只是一个虾纸丫 提交于 2019-12-29 09:37:15

问题


Recently, I have one problem. The clang can translate Objective-C to c++ use -rewrite-objc. So I think, the first step. clang compile Objective-C to C++. And then compile only can use c++ compiler. Is it do like this? clang first translate Objective-C to C++ with runTime, and then compile to the machine code?


回答1:


-rewrite-objc exists to translate ObjC to C++ so it can be compiled in the Visual Studio. It is still Objective-C semantics and you still need the objective-c runtime. It is not magically converting Objective-C to the C++ OO architecture.

This is much more like when Objective-C was implemented as a pre-compiler extension.

It all relies on the fact that Objective-C classes are just C structures with fancy behavior and objective-c method calls all can be translated to calls to objc_msgSend().



来源:https://stackoverflow.com/questions/44561285/rewrite-objc-and-objective-c-in-clang

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!