Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Advanced
Sep 1, 2009

Running 32-bit Applications with 32-bit DLLs on 64-bit Operating Systems

The 32-bit DLLs run on the both 32-bit as well as 64-bit operating system or environment. But only the 32-bit mode application can load the 32-bit mode DLLs. By default a .NET application is configured to run on any CPU—the application (an executable file) can run on both 32-bit and 64-bit operating systems.

First, consider the scenario with 32-bit operating system, 32-bit dependent DLLs, and a 32-bit application. In this scenario, the 32-bit application can load 32-bit DLLs, so the application will run as desired. However, there's another scenario; when a user tries to run the same 32-bit application on a 64-bit operating system, the application will run in 64-bit (any CPU) mode and will fail to load the 32-bit DLLs. The solution to this problem is very simple. Force the application to run in 32-bit mode by following this procedure in Visual Studio to set the compile options:

  1. Open the project properties page.
  2. Go to the "Compile" tab and click on the "Advanced Compile Options" button.
  3. Set the "Target CPU" item to "x86"

This procedure enables the application to run in 32-bit mode, so it will successfully load the 32-bit mode DLLs on 64-bit machines, and the application will run successfully on both 32-bit and 64-bit machines.

Prafulla Doye
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap