Write a DEF File

Because you're going to be compiling and linking MIDL-generated code, you'll have to provide a module definitions file for the linker, which MIDL does not generate itself. Specifically, you need to name the resulting module and export the functions DllGetClassObject, DllCanUnloadNow, and GetProxyDllInfo, as shown here for IANIMAL.DLL:


LIBRARY         IANIMAL
DESCRIPTION 'IAnimal Interface Proxy/Stub DLL Chapter 6'

CODE PRELOAD DISCARDABLE
DATA PRELOAD SINGLE

EXPORTS
DllGetClassObject @2
DllCanUnloadNow @3
GetProxyDllInfo @4

You don't actually have to implement these exported functions because RPCRT4.LIB provides them—you need only to export them. But failure to do so will lead to some quite ugly problems that you'd be happier avoiding altogether.