Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
_export
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Keyword: _export
Syntax: _export declarator
Summary: Exports a function from a dynamic-link library.
When present in a function declaration or definition, the _export
keyword causes the compiler to place information in the object
file to show that this function can be exported from a protected-
mode dynamic-link library.
The main use for _export is to create functions that will reside
in a dynamic-link library. However, you may also need to export
functions for Microsoft Windows(TM) or for the Presentation
Manager.
This feature does not necessarily eliminate the need for a module-
definition (.DEF) file when building a dynamic-link library. If no
module-definition entry exists for the function that is to be
exported, the linker assumes that the function has certain
characteristics. Namely, it assumes that the function has no
input/output (I/O) privilege, has shared data, is not resident,
and has no alias name.
If these default characteristics are satisfactory, as they will be
in many cases, the function in question does not require an entry
in a module-definition file. If they are not satisfactory,
however, you must create an EXPORTS entry for the function. This
is because the only way to specify these characteristics is in a
module-definition file.
The _export keyword also causes the compiler to place the number
of parameter words for the function into the export record in the
object module. This information corresponds to the iopl_parmwords
field in an EXPORTS statement in a module-definition file. You
cannot override this information with an EXPORTS entry in the
module-definition file.
If you do have an EXPORTS entry for a function, the iopl_parmwords
field in that entry should be set either to 0 (which tells the
linker to use the same value given by the compiler), or to the
same value given by the compiler. Note that the iopl_parmwords
field is ignored unless you also request I/O privilege.
If you wish to create an import library for the dynamic-link
library containing the function in question, you must provide a
module-definition-file entry for every function that you wish to
export.
The following statement declares funcsample as a far pascal
function that takes a single argument of any pointer type and does
not return a value. The presence of _export causes the function to
be exported.
void _export _far _pascal funcsample( void *s );
-♦-