next up previous contents index
Next: Assembler functions Up: Using functions and procedures Previous: forward defined functions

External functions

  The external modifier can be used to declare a function that resides in an external object file. It allows you to use the function in your code, and at linking time, you must link the object file containing the implementation of the function or procedure.


External directive

syntdiag4274

It replaces, in effect, the function or procedure code block. As such, it can be present only in an implementation block of a unit, or in a program.

As an example:
listing4245

Remark The parameters in our declaration of the external function should match exactly the ones in the declaration in the object file.

If the external modifier is followed by a string constant:
listing4251
Then this tells the compiler that the function resides in library 'lname'. The compiler will the automatically link this library to your program.

You can also specify the name that the function has in the library:
listing4253
This tells the compiler that the function resides in library 'lname', but with name 'Fname'. The compiler will the automatically link this library to your program, and use the correct name for the function.

Under WINDOWS and OS/2, you can also use the following form:
listing4255
This tells the compiler that the function resides in library 'lname', but with index Ind. The compiler will the automatically link this library to your program, and use the correct index for the function.


next up previous contents index
Next: Assembler functions Up: Using functions and procedures Previous: forward defined functions

Michael Van Canneyt
Fri Sep 25 09:15:40 MEST 1998