Re: [问题] (非功课><)想问MAC上编译程式

楼主: dryman (dryman)   2012-11-25 10:22:36
身为老人来回一下XD
GNU/Linux 和 Mac OSX 虽然都是UNIX的作业环境
但是它们的kernel是完全不一样的系统
Linux是单核心,为潜在的硬件,提供了大量完善的硬件抽象操作。
Mac是微核心,结构由一个非常简单的硬件抽象层和一组比较关键的原语或系统呼叫组成
(后来改成混合核心,但还是比较偏向微核心)
核心详见
http://zh.wikipedia.org/zh-tw/内核
以不同核心为起点发展出来的bianry,也会不一样
GNU/Linux, BSD是用ELF
http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
ELF was designed with the assumption that
there would be only one ABI per system architecture.
^^^ 与 kernel 沟通的接口
PS BSD 原本是用 UNIX 最初的a.out binary format
原本ELF是用模拟的方式运行的,但后来Linux太盛行了所以也改用 ELF
http://www.freebsd.org/doc/handbook/binary-formats.html
Mac OSX是用Mach-O
http://en.wikipedia.org/wiki/Mach-O
Mach-O 的一个特色是,可以包含不同格式的binary code进去一个档案
在过去,苹果有PowerPC-32, PowerPC-64, x86, x86-64等不同的机器
使用Mach-O可以制作fat binary file来让一个软件可在不同机器上运行
这归功于微核心强大的ABI接口 :D
Mach-O 还有双层命名空间的设计
可以避免dynamic library的变量及function打架
The two-level namespace feature of OS X v10.1 and later adds the
module name as part of the symbol name of the symbols defined
within it. This approach ensures a module’s symbol names don’t
conflict with the names used in other modules. To perform special
tasks or to provide an enhanced user experience, your application
may need to launch other applications or create processes to run
command-line tools. To maintain a high degree of interoperability
and provide a consistent user experience, your applications should
use specific system functions and frameworks to execute processes
and launch applications.
作者: XDucka (Duck)   2011-01-25 13:27:00
专业推
作者: ypf791 (路人1号)   2011-01-25 13:52:00
作者: kaiwen789 (kaiwen789)   2011-01-25 18:36:00
专业推!! 感谢学长的回答!!!

Links booklink

Contact Us: admin [ a t ] ucptt.com