I'm trying to find out how the whole assembly chain works, so I can better understand what happens when I create / link / compile, etc.
One problem I encountered is the following: if the compiler turns the source into its own assembly, why can't the same program work on different OS? Is the assembly performed directly by the processor? Thus, the same machine code should work on each OS, if it is the same architecture, no? Why not?
EDIT: . Most of the answers currently concern calling the OS APIs. This is obviously a problem. My question is about direct machine code . Is it transferred directly to the CPU or not? If I wrote the program in the assembly, would I still have to compile separately for each OS? (lateral point: if I used standard C ++ cin / cout, it depends on the OS, is it compiled for direct input / output of the assembly or does it depend on the response to the compiler?)
source
share