To link your program to a library, the procedure depends on how you declared the external procedure.
In case you used the follwing syntax to declare your procedure:
Procedure ProcName (Args : TPRocArgs); external 'Name';You don't need to take additional steps to link your file in, the compiler will do all that is needed for you. On WINDOWSNT it will link to Name.dll, on LINUX your program will be linked to library libname, which can be a static or dynamic library.
In case you used
Procedure ProcName (Args : TPRocArgs); external;You still need to explicity link to the library. This can be done in 2 ways:
{$LinkLib 'gpm'}This will link to the gpm library. On LINUX systems, you needn't specify the extension or 'lib' prefix of the library. The compiler takes care of that. On DOS or WINDOWS systems, you need to specify the full name.
ppc386 -k'-lgpm' myprog.ppIs equivalent to the above method, and tells the linker to link to the gpm library.
As an example; consider the following program :
program printlength; {$linklib c} { Case sensitive } { Declaration for the standard C function strlen } Function strlen (P : pchar) : longint; cdecl;external; begin Writeln (strlen('Programming is easy !')); end.This program can be compiled with :
ppc386 prlen.ppSupposing, of course, that the program source resides in prlen.pp.
You cannot use procedures or functions that have a variable number of arguments in C. Pascal doesn't support this feature of C.