Why are “Executable files” operating system dependent?

后端 未结 6 2129
无人共我
无人共我 2020-12-24 11:22

I understand that each CPU/architecture has it\'s own instruction set, therefore a program(binary) written for a specific CPU cannot run on another. But what i don\'t really

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-24 11:45

    Apart from the executable format that must be recognized by the system loader (i.e. that part of an OS that brings the executable into memory) the real problem is the interface to the OS. You can think of an OS as a kind of API that provides entry points one must call for doing specific things, like for example, writing a character to the console.

    These details are usually more or less hidden from the end user, so that you can achieve writing a character to the screen with the same source code in higher level languages. But often, things are more different, like for example the Windowing environment. Not all high level languages provide a windowing layer that abstracts even over those differences.

提交回复
热议问题