Linker Tools Warning LNK4222
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Linker Tools Warning LNK4222.
exported symbol 'symbol' should not be assigned an ordinal
The following symbols should not be exported by ordinal:
DllCanUnloadNowDllGetClassObjectDllGetClassFactoryFromClassStringDllInstallDllRegisterServerDllRegisterServerExDllUnregisterServer
These functions are always located by name, using GetProcAddress. The linker warns about this kind of export is because it could result in a larger image. This could happen if the range of your ordinal exports is large with relatively few exports. For example,
EXPORTS DllGetClassObject @1 MyOtherAPI @100
will require 100 slots in the export address table with 98 of them (2-99) just filler. On the other hand,
EXPORTS DllGetClassObject MyOtherAPI @100
will require two slots. (Be aware that you can also export with the /EXPORT linker option.)