Is a Linux executable “compatible” with OS X?

前端 未结 5 1154
孤城傲影
孤城傲影 2020-11-29 08:08

If you compile a program in say, C, on a Linux based platform, then port it to use the MacOS libraries, will it work?

Is the core machine-code that comes from a comp

5条回答
  •  清歌不尽
    2020-11-29 08:52

    Well, maybe... but most probably not.

    But if it does, it's not "because both are UNIX" it's because:

    • Mac computers happen to use the same processor nowadays (this was very different in the past)
    • You happen to use a program that has no dependency on any library at all (very unlikely)
    • You happen to use the same runtime libraries
    • You happen to use a loader/binary format that is compatible with both.

提交回复
热议问题