Exports: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Exports
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Back to the [[Reserved words]]. | |
| 2 | + | ||
| 3 | + | The reserved word **exports** is used to export names when creating a shared library or an executable program. It means that the symbol(s) will be publicly available, and can be imported from other programs. | |
| 4 | + | ||
| 5 | + | Example: | |
| 6 | + | ||
| 7 | + | ``` pascal | |
| 8 | + | library TestLibrary; | |
| 9 | + | ||
| 10 | + | {$mode objfpc} {$H+} | |
| 11 | + | ||
| 12 | + | uses | |
| 13 | + | SysUtils; | |
| 14 | + | ||
| 15 | + | // library subroutine | |
| 16 | + | function cvtString(strIn : string) : PChar; cdecl; | |
| 17 | + | begin | |
| 18 | + | cvtString := PChar(UpperCase(strIn)); | |
| 19 | + | end; | |
| 20 | + | ||
| 21 | + | // exported subroutine(s) | |
| 22 | + | exports | |
| 23 | + | cvtString; | |
| 24 | + | end. | |
| 25 | + | ``` | |
| 26 | + | ||
| 27 | + | --- | |
| 28 | + | *From the Free Pascal wiki, page "Exports", as it stood on 2020-02-14 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
