Visual Studio 2012 32bit compilation on 64bit system

29,275

Solution 1

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.

Solution 2

  • 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.

Share:
29,275
joker.neophyte
Author by

joker.neophyte

Updated on July 09, 2022

Comments

  • joker.neophyte
    joker.neophyte almost 2 years

    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