The #pragma export directive declares that a DLL function or
variable is to be exported and specifies the name of the function
or variable outside the DLL.
The identifier is the name of the function or variable in the DLL.
If the identifier is the name of an
overloaded function or a member function, there is a risk that
the pragma will override the compiler-generated names. This will
create problems during linking.
The export_name is the name for identifier outside of the DLL. If no export_name is specified, identifier is used.
The ordinal is the number of the identifier within the DLL. Another module can import the identifier using either the export_name or the ordinal number.
Under OS/2, import by ordinal number is
only permitted using the DosQueryProcAddr.
Under Windows, import by ordinal number is only permitted using
the Win32 API GetProcAddress (refer to the Win32 API
documentation for more information).
For example, the statements:
int deborah(int); #pragma export(deborah, "catherine", 4)
declare that the function deborah is to be exported, and can be imported by another module using the name catherine or the ordinal number 4.
You can also use the _Export keyword to export a function. If you use the keyword, you cannot specify a different name or an ordinal for the exported function.
If you use #pragma export to export your function, you may still need to provide an EXPORTS entry for that function in your module definition (.DEF) file. If your function has any of the following default characteristics
it does not require an EXPORTS entry. If your function has characteristics other than the defaults, the only way you can specify them is with an EXPORTS entry in your .DEF file.
Note: To create an import library for the DLL, you must either create it from the DLL itself or provide a .DEF file with an EXPORTS entry for every function, regardless of whether #pragma export is used.