When a function or procedure is called, the calling code and the function or procedure being called must agree on three basic things:

  1. The way parameters of different types are passed.
  2. The way function return results are passed back to the calling code.
  3. The way the responsibility for cleaning-up after the call is shared between the calling code and the function or procedure.
These agreements are called calling conventions.