C ++ exports def file and exportsdef File
Https://msdn.microsoft.com/zh-cn/library/hyx1zcd3 (v = vs.80). aspx EXPORTS
Introduces a section composed of one or more definitions (exported functions or data. Each definition must be on a single row.
EXPORTSdefinitions
Remarks
EXPORTSThe keyword can be on the same row or the previous row where the first definition is located .. Def files can contain one or moreEXPORTSStatement.
The syntax for exporting definitions is:
entryname[=internalname] [@ordinal [NONAME]] [PRIVATE] [DATA]
EntrynameIs the name of the function or variable to be exported. This is required. If the exported name is different from the DLL nameInternalnameSpecify the name exported from the DLL. For example, if the DLL exports a functionFunc1 ()To use itFunc2 (), You should specify:
EXPORTSfunc2=func1
@ Ordinal: Specify the sequence number instead of the function name to enter the DLL export table. This helps minimize the DLL size .. The LIB file will contain the ing between the serial number and the function, which allows you to use the function name as usual in a DLL project.
OptionalNONAMEThe keyword can only be exported by serial number, and the size of the exported table in the result DLL is reduced. However, if you want to use GetProcAddress on the DLL, you must know the sequence number because the name will be invalid.
OptionalPRIVATEDisableEntrynameImport data to the database generated by LINK. It is invalid for exporting images generated by links.
OptionalDATAKeyword specifies that the exported data is not the code. For example, you can export data variables as follows:
EXPORTSi DATA
When the same export is usedPRIVATEAndDATA,PRIVATEMust be locatedDATA.
There are three methods for exporting definitions, which are recommended in sequence:
All three methods can be used in the same program. LINK also creates Import and Export files when generating programs that contain export, unless the. exp file is used in the generation.
The following is an example of the EXPORTS section:
EXPORTS DllCanUnloadNow @1 PRIVATE DATA DllWindowName = Name DATA DllGetClassObject @4 NONAME PRIVATE DllRegisterServer @7 DllUnregisterServer
Note: when using the. def file to export variables from the DLL, you do not need to specify_ Declspec (dllexport). However, in any DLL file, it must still be used in the data declaration._ Declspec (dllimport).