I am assuimg the code will be written in C.
I have studied that compiler complies the code (Lexical Analysis, Syntax Analysis etc) and converts our code to assembly code and then assembler assembles the code to the machine code, which is finally executed on the Hardware.
So i have a doubt that whether the code which is written for the system calls is portable i.e. If i will compile the same code on some hardware will this code run?
Am i right in saying that the only architecture dependent part is compiler and system calls once compiled on other architectures will run fine?
System calls depends on Operating system as well as architecture. Most of the cases, your program should be re-compiled if the architecture or operating system is different.
for example
sbrkandbrksystem calls which is used for malloc() i.e dynamic memory allocation not available in windows.Refer how malloc is implemented in windows Windows memory allocation questions
There are two types of system calls namely “machine architecture independent” and “machine architecture dependent” available.
If you use only machine architecture independent then there will be not much worry in porting.
Coming to answer for your question :
so it depends on which system call you used. But re-compile is must.