Share via


Export Functions from a DLL By Ordinal Rather Than By Name

OverviewHow Do IFAQDetailsSample

The simplest way to export functions from your DLL is to export them by name. This is what happens when you use __declspec(dllexport), for instance. But you can instead export functions by ordinal. With this technique, you must use a .DEF file instead of __declspec(dllexport). To specify a function’s ordinal value, append its ordinal to the function name in the .DEF file. For information on specifying ordinals, see Export from a DLL Using .DEF Files.

Tip   If you want to optimize your DLL’s file size, use the NONAME attribute on each exported function. With the NONAME attribute, the ordinals are stored in the DLL’s export table rather than the function names. This can be a considerable savings if you are exporting many functions.

What do you want to do?