Objective-C是否编译为本机代码或字节代码? [英] Does Objective-C compile to native code or byte-code?
问题描述
在OS X上,Objective-C是否编译为本地代码或字节码?
On OS X, does Objective-C compile to native code or byte-code?
Objective-C程序可以在Linux上编译吗?
Can Objective-C programs be compiled on Linux?
推荐答案
你可以在Linux上编译ObjC程序(通用的GCC会很乐意支持ObjC,虽然它使用的是不同于Apple的运行时库)。对于类似Cocoa(即派生自Cocoa)的跨平台API,它将乐于在Linux上工作,并允许在OS X和Linux之间传递一些代码,请查看GNUstep: http://www.gnustep.org
Objective-C is compiled to native code by either GCC or LLVM[*]. You can compile ObjC programs on Linux (the generic GCC will happily support ObjC, though it uses a different runtime library than either of the Apple ones). For a cross-platform API similar to Cocoa (i.e. derived from Cocoa) which will happily work on Linux and let you port some code between OS X and Linux, check out GNUstep: http://www.gnustep.org
[*]事实上,LLVM内部编译Objective-C到内部位码表示,然后为目标机器编码,所以也许答案是两个...
[*]In fact, LLVM internally compiles the Objective-C to an internal bitcode representation, then to code for the target machine, so perhaps the answer is "both"…
这篇关于Objective-C是否编译为本机代码或字节代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!