7.1 Using external code and variables

In general, there are 3 things you must do to use a function that resides in an external library or object file:

  1. You must make a pascal declaration of the function or procedure you want to use.
  2. You must declare the correct calling convention to use.
  3. You must tell the compiler where the function resides, i.e. in what object file or what library, so the compiler can link the necessary code in.

The same holds for variables. To access a variable that resides in an external object file, you must declare it, and tell the compiler where to find it. The following sections attempt to explain how to do this.

  7.1.1 Declaring external functions or procedures
  7.1.2 Declaring external variables
  7.1.3 Declaring the calling convention modifier
  7.1.4 Declaring the external object code
   Linking to an object file
   Linking to a library