RSS

Porting C++ based application from 32-bit Architecture to 64-bit on Windows

07 May

I have been thinking since a long time to make this post. But because of some busy schedules its been delayed so long.

When I was working with Trilogy, I got a good opportunity to work on a very important project – Its porting a legacy (a product with around 20 years history 🙂 ) 32-bit application to 64-bit. I felt it as a challenging task for a frehser out of college. There were many people/customers who wanted this product to be in 64-bit because of the huge memory capabilities it provides.

The source code is in C++. Though I had no knowledge of difference between 32-bit and 64-bit application and no touch with C++, I took it as a challenge. Many night-outs went into it. I would cover some things like:

1. Visual Studio Settings required to port
2. Utility to check if a application is 32-bit or 64-bit
3. Links that might be of use

1. Visual Studio Settings required to port

1. Visual Studio 2005 and 2008 has the capability of building applications in 64-bit mode.
2. Open your application source code in Visual Studio.
3. Lets consider building in Debug mode, for that change solution configuration to ‘Debug’ in the selector at the top of IDE window.
4. Click Build->Configuration Manager. You get the Configuration manager window. In this Window select the Active solution platform-> New.
5. In Type or select new platform -> Select x64. If this option doesn’t exist then the x64 components are not installed properly with the VS 2005/2008.
6. Now repeat the following steps for all modules. This will change the configuration settings for the project.

Project Settings:

a)      Click on <your_application> in left panel -> Right Click on it -> Click Clean
b)      Now Right Click on <your_applications> -> Click properties -> A dialog box will open
c)      From the left pane of this dialog box, select C/C++ -> Code Generation -> In Runtime Library option, select Multi-threaded debug (/MTd).
d)     Add preprocessor directive _MT in C/C++ -> Preprocessor
e)      In <your_applications/required_projects> properties C/C++->Preprocessor-> Preprocessor Definitions, remove “_IX86_=1” and replace it with “_AMD64_=1”
f)       Also in <your_applications> properties add “_AMD64_=1” in C/C++->Preprocessor-> Preprocessor Definitions.

2. Utility to check if a application is 32-bit or 64-bit

We can also use the following utility (Click here) in order to know specific information about a file.
The usage of this file has been mentioned in
http://support.microsoft.com/kb/913111
The file type should be either Wx64 (if filever.exe is 64-bit) or W32 (if filever.exe is 32-bit) for the executables/lib/dll files, which we built.

3.  Links that might be of use

1. 20 common issues that you face while porting application from 32-bit architecture to 64-bit architecture.
Click here
2. http://msdn.microsoft.com/en-us/library/ms538044(VS.85).aspx
3. http://msdn.microsoft.com/en-us/library/3b2e7499(VS.80).aspx
4. http://msdn.microsoft.com/en-us/library/h2k70f3s.aspx

Note: The above mentioned information/links are done some time back, but I think they are still valid. Please leave a comment if you find any mistakes in the above. This post might be of some use in getting started atleast 🙂

Advertisements
 
2 Comments

Posted by on May 7, 2010 in Uncategorized

 

Tags: , , , ,

2 responses to “Porting C++ based application from 32-bit Architecture to 64-bit on Windows

  1. Vasu

    May 8, 2010 at 8:43 pm

    Gud information 🙂

     
  2. ranganathg

    May 9, 2010 at 10:37 am

    thanks Vasu 😉

     

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: