this question has answer here:
- why c platform-dependent? [duplicate] 5 answers
i learned c-compiler translate high level c code machine level code, according instruction encoding of underlying processor makes compile code processor dependent. understood. why compiled c program os dependent. question why can't 2 machine having similar processor(same instruction encoding) different os run same compiled c file, compiled on 1 of them. understand linux cant run windows's .exe , vice versa , every os has different system call mechanism, these os level things, why these things makes machine level(instruction level) compiled file dependent on them.
please me..
the compiled machine code indeed execute on operating systems running on same architecture (assuming binary files in format compatible with, each os, aren't - executable files aren't instructions 1 after another, have trouble getting each os read machine code).
however, program using no os-specific calls accomplish other taking processor cycles? instance, c standard library can not implemented without os-specific calls (e.g., how malloc, or fopen, or indeed i/o). portable program not use library functions, , os prevent directly accessing hardware, or memory belonging other programs (a simple os dos might exception).
Comments
Post a Comment