What is the role of the OS here? Does it interfere with the type of machine code? Does the compiler require to link additional libraries in order to run the program on certain os?
I started writing software in 1984. Over the years I worked with many languages, technologies, and tools. I have been in leadership positions since the early 2000s, and in executive roles since 2014.
When you compile a program you might have to choose the target system.
Usually, a compiler that runs on a system will compile for that system, but that is not always the case. (For example, you can compile an Arduino sketch on a Mac. The compiler runs on the Mac, but the executable runs on the Arduino.)
Depending on the program, the compiler will most likely have to link your code with OS specific libraries. Some libraries are standard, and always available on all OS's (example: standard IO in C). Using only standard libraries make your code portable to many systems.
Other libraries are not standard and make your code not easily portable to other OSs.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What is the role of the OS here? Does it interfere with the type of machine code? Does the compiler require to link additional libraries in order to run the program on certain os?
When you compile a program you might have to choose the target system.
Usually, a compiler that runs on a system will compile for that system, but that is not always the case. (For example, you can compile an Arduino sketch on a Mac. The compiler runs on the Mac, but the executable runs on the Arduino.)
Depending on the program, the compiler will most likely have to link your code with OS specific libraries. Some libraries are standard, and always available on all OS's (example: standard IO in C). Using only standard libraries make your code portable to many systems.
Other libraries are not standard and make your code not easily portable to other OSs.