c - Why are executables in machine code operating system dependent? -
in windows, when compile simple 'c' program, final executable machine code .exe
. same thing using gcc in unix yields .out
machine code file.
what's difference between these?
my basic question is, .exe
, .out
being machine codes, why operating system dependent?
as in, in unix cannot execute .exe
directly , in windows, can't execute .out
of unix. why so?
it has how program loaded.
windows , linux have different formats how want program define itself.
in linux, elf format used. windows pe.
these formats define different data program needed execute machine instructions.
also, operating system interfaces different, different libraries need used , different system calls need made.
for simple program, can recompile on other operating system have work on both, not able use single file on both.
Comments
Post a Comment