#EXPORT metastatement  

Purpose

Declare a Sub/Function to have the EXPORT attribute.

Syntax

#EXPORT SubFuncName [, SubFuncName...]

Remarks

#EXPORT allows you to add the EXPORT attribute to a Sub/Function defined elsewhere.   The EXPORT attribute can even be added to a Sub/Function in an SLL which was compiled separately.

The EXPORT descriptor identifies a Sub/Function which may be accessed between modules, and/or the main executable which links them.  If a procedure is not marked EXPORT, it is hidden from these other modules.  Generally speaking, it's best not to mark a Sub/Function in an SLL as EXPORT.  While it is syntactically acceptable, it may limit your future options when linking the SLL into host modules.  PowerBASIC recommends that you mark them as COMMON in the SLL, and add the EXPORT attribute in the host module.

It's easy to create an SLL which can be linked into an executable program or another module for the same purpose.  To add the EXPORT attribute to a linked Sub/Function, just add the word EXPORT to the DECLARE statement in the host module or add an #EXPORT metastatement.

Using this technique, your SLL can be linked directly into an application executable without publishing the Subs/Functions as EXPORT.

See also

#LINK, DECLARE