Linker Tools Error LNK1306

 

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 Error LNK1306.

DLL entry point function cannot be managed; compile to native

DllMain cannot be compiled to MSIL; it must be compiled to native.

To resolve,

The following sample generates LNK1306.

// LNK1306.cpp  
// compile with: /clr /link /dll /entry:NewDllMain  
// LNK1306 error expected  
#include <windows.h>  
int __stdcall NewDllMain( HINSTANCE h, ULONG ulReason, PVOID pvReserved ) {  
   return 1;  
}  

Show: