In Chapter 4, we discussed how the stack and the
call instruction are used for function calls. Function calls can
appear differently in assembly code, and calling conventions govern the way the function call
occurs. These conventions include the order in which parameters are placed on the stack or in
registers, and whether the caller or the function called (the callee) is
responsible for cleaning up the stack when the function is complete.
The calling convention used depends on the compiler, among other factors. There are often subtle differences in how compilers implement these conventions, so it can be difficult to interface code that is compiled by different compilers. However, you need to follow certain ...