According to MSDN:
https://msdn.microsoft.com/en-us/library/hyx1zcd3.aspx, there are four ways to export a definition, listed in recommended order:
- The __declspec(dllexport) keyword in the source code
- An EXPORTS statement in a .DEF file
- An /EXPORT specification in a LINK command
- A comment directive in the source code, of the form #pragma
- comment(linker, "/export:
definition
")
The advantages of .DEF files are as follows:
- You can export by ordinal
The disadvantages of .DEF files are that:
- You have an additional file to maintain
- You have to use the decorated function names
The advantage of exporting by ordinal is that you can reduce the size of the export table. However, then you have to use the ordinals instead of friendly names.