In order to use a function that resides in a library, it is su cient to declare the function as
it exists in the library as an external function, with correct arguments and return
type. The calling convention used by the function should be declared correctly as well.
The compiler will then link the library as speci ed in the external statement to your
program .
For example, to use the library as de ned above from a pascal program, you can use the following
pascal program:
Listing: progex/psubs.pp
As is shown in the example, you must declare the function as external. Here also, it is necessary
to specify the correct calling convention (it should always match the convention as used by the
function in the library), and to use the correct casing for your declaration. Also notice, that
the library importing did not specify the lename extension, nor was the lib pre x
added.
This program can be compiled without any additional command-switches, and should run just like
that, provided the library is placed where the system can nd it. For example, on linux, this is
/usr/lib or any directory listed in the /etc/ld.so.conf