Quick start manual
9-6
Delphi Language Guide
Writing dynamically loadable libraries
The exports clause
A routine is exported when it is listed in an exports clause, which has the form
exports entry
1
, ..., entry
n
;
where each entry consists of the name of a procedure, function, or variable (which
must be declared prior to the exports clause), followed by a parameter list (only if
exporting a routine that is overloaded), and an optional name specifier. You can
qualify the procedure or function name with the name of a unit.
(Entries can also include the directive resident, which is maintained for backward
compatibility and is ignored by the compiler.)
On Windows only, an index specifier consists of the directive index followed by a
numeric constant between 1 and 2,147,483,647. (For more efficient programs, use low
index values.) If an entry has no index specifier, the routine is automatically assigned
a number in the export table.
Note
Use of index specifiers, which are supported for backward compatibility only, is
discouraged and may cause problems for other development tools.
A name specifier consists of the directive name followed by a string constant. If an
entry has no name specifier, the routine is exported under its original declared name,
with the same spelling and case. Use a name clause when you want to export a
routine under a different name. For example,
exports
DoSomethingABC name 'DoSomething';
When you export an overloaded function or procedure from a dynamically loadable
library, you must specify its parameter list in the exports clause. For example,
exports
Divide(X, Y: Integer) name 'Divide_Ints',
Divide(X, Y: Real) name 'Divide_Reals';
On Windows, do not include index specifiers in entries for overloaded routines.
An exports clause can appear anywhere and any number of times in the declaration
part of a program or library, or in the interface or implementation section of a unit.
Programs seldom contain an exports clause.