joker.neophyte
joker.neophyte

Reputation: 77

Visual Studio 2012 32bit compilation on 64bit system

I have recently wanted to build a dll plugin for a program. Problem is, the program is 32bit, but by default my Visual Studio 2012's C++ compiler creates 64bit binaries, and I don't know how to change it - I've found the Configuration Manager and tried to create a new platform but there's only x64 as an option.

Am I trying to set the target architecture in the wrong place or what? Is there an update or something I can download so that I can create my dll? Is there a compiler switch that I can set somewhere?

Hope this screen helps:

enter image description here

Upvotes: 4

Views: 30770

Answers (2)

To build for 32 bit architecture, you have to open project properties window, and then Linker options.

Set the value of Target Machine option to MachineX86.

Upvotes: 3

Ajay
Ajay

Reputation: 18411

  • Check the Build Configuration (Build -> Configuration Manager), and ensure that your DLL project for 32-bit is selected.
  • Check the linker settings, and ensure correct path is given.
  • After build, check that .DLL is produced at correct path, and is 32-bit (should be!).

You can use Dependency Walker to check if DLL is 32-bit or 64-bit. You also didn't mention if /clr option is used with this DLL or not. With /CLR, managed binary is produced. Though this option wouldn't alter bit-ness of the binary, you can just check if this is the case.

Upvotes: 2

Related Questions