How to generate a 32bit only Managed C++ Assembly

469 views Asked by At

I need to compile a DLL in Managed C++ in Visual Studio 2005.

I want it with 32Bit corflag on. See http://illuminatedcomputing.com/blog/?p=117 for reference.

By default, I choose Win32 platform and set the /MACHINE:X86 option in the liker, but the DLL generated has the 32bit corflag off. You can see it by executing from command line

corflags MyDll.dll

I have problems when running that dll in a Windows 64 bit. So I need to force the dll to 32 bit.

Any idea on how to configure the Visual Studio 2005 compiler?

1

There are 1 answers

0
Drew Gaynor On

You can actually use CorFlags.exe to set this. In the command line:

corflags MyDll.dll /32BIT+

This will set the 32 bit flag for MyDll.dll.

For more information see the corflags tag wiki.