Name
Exports Keyword
Syntax
exportsSubroutine,SubroutinenameIdentifier,SubroutineindexConstant,SubroutineindexConstantnameIdentifier, ...;
Description
The exports declaration lists the names or
signatures of subroutines to be exported from a DLL. You can declare
subroutines to export in any unit or in the library’s project
file.
If a subroutine is overloaded, you can specify which subroutine to
export by including the subroutine’s arguments in the
exports declaration. You can export multiple
overloaded subroutines, but make sure the caller is able to identify
which one it wants to call by assigning a unique name to each
one.
By default, the subroutine is exported under its own name, but you can specify a different name or an index number. If you do not supply an index, Delphi automatically assigns one.
Tips and Tricks
You can use the
indexandnamedirectives for the same exported routine (in that order).Delphi does not check for duplicate indices, so be careful.
Delphi 5 does not allow the
indexdirective for overloaded subroutines.
Example
unit Debug; interface // Simple debugging procedures. Debug messages are written to // a debug log file. You can link this unit into an application, // or use in a DLL. See the External Directive for an example // of how an application can use these procedures from a DLL. procedure Log(const Msg: string); overload; procedure Log(const Fmt: string; const Args: array of const); overload; procedure SetDebugLog(const FileName: string); function ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access