Originale-mail to me for new edition

 

The exports clause

 

A routine is exported when it is listed in an exports clause, which has the form

exports entry1, ..., entryn;

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.

 

Topic groups

 

See also

External declarations

Writing dynamically loadable libraries

 

 

译文

 

exports子句

 

列于一个exports子句中的例程是被输出的。exports子句具有如下形式

exports entry1, ..., entryn;

这里的每个entry(入口)由过程、函数或变量(在exports子句中必须是优先声明的),跟随的参数列表(仅当输出的例程是重载的例程时),以及可选的name说明符组成。在exports子句中,可以用单元名称作为过程或函数名称的限定词(以更加准确地标明要输出的例程)。

(入口还可以包括指示字resident,该指示字用于维持向后兼容的特性,它将被编译器忽略。)

对于且仅对于Windowsindex说明符由指示字index及跟随的数字常量组成,数字常量的范围在12147483647之间。(对于更有效的程序,应使用低的索引值。)如果一个入口没有index说明符,那么在输出表中将会自动为该例程指定一个数字。

注意:index说明符仅用于向后兼容,该说明符已无用处并且可能致使其他开发工具发生问题。

name说明符由指示字name及跟随的串常量组成。如果一个入口没有name说明符,那么该例程将以其最初声明的名称(相同的拼写和大小写)被输出。想要以不同的名称输出一个例程时,应使用name说明符。例如,

exports

  DoSomethingABC name 'DoSomething';

从动态可加载库中输出重载的函数或过程时,必须在exports子句中指定其参数列表。例如,

exports

  Divide(X, Y: Integer) name 'Divide_Ints',

  Divide(X, Y: Real) name 'Divide_Reals';

对于Windows,在重载例程的入口中不要包含index说明符。

在程序或库的声明部分,或在单元的接口节(interface)或实现节(implementation),exports子句可以出现在任何位置并且不限次数。程序中很少含有exports子句。

 

主题组

 

相关主题

外部声明

编写动态可加载库