Re: porting 32-bit to 64-bit on Xeon



hi

happy to say that 64-bit app can be developed in vc6 to run on 64-bit
OS on 64-bit m/c. here is the procedure to develop a 64-bit app for
win2k3 64-bit or xp 64-bit to run on a 64-bit m/c. and companies r doin
this way. this is my official policy to develop in vc6.

SUMMARY

=======

This step-by-step article describes how to use the Microsoft Visual
Studio

IDE to build 64-bit applications while you maintain the same code base
for

both 32-bit and 64-bit development. To maintain the same code base, you
use

two different build configurations.

Because the native 64-bit IDE is still under

development, no IDE exists for 64-bit development. The current

Software

Development Kit (SDK) includes the compiler, the linker, and other

tools for

64-bit development. The SDK also includes the C-Runtime (CRT)

library, the

Microsoft Foundation Classes (MFC), and the Active Template Library

(ATL)

versions for 64-bit production.

You can use either the Microsoft Visual

C++ 6.0 or the Microsoft Visual C++ .NET IDE to build 64-bit

applications. This is useful if

you have an existing 32-bit application and you want to migrate it

to a 64-bit

application. This article describes how to perform a 64-bit build

as a

different build configuration of the same project.



Requirements

------------

The following list

outlines the recommended hardware, software, network

infrastructure, and

service packs that you need:

- Microsoft Platform SDK of November 2001 or later

- Visual C++ 6.0 or Visual C++ .NET (2002 or 2003)



Build a 64-Bit Application by Using the Visual C++ 6.0 IDE

----------------------------------------------------------

Set the 64-Bit Build Environment

Variables

To set the 64-bit build environment variables, use either of the
following

methods:

- Click "Start", point to "Microsoft Platform SDK", point to "Open

Build Environment Window", point to "Set Windows XP 64 Build

Environment", and then click "Set Windows XP 64 Build Environment

(Debug)". A console window with the build environment set for a 64-bit


build is displayed.

- To set the 64-bit environment variables at the command

prompt, follow these steps:

1. Click "Start", and then click

"Run".

2. Type "command.exe" (without the quotation marks), and then click

"OK".

3. Change the folder to C:\Program Files\Microsoft SDK,

and then type "SetEnv.bat /XP64" (without the quotation

marks).



Start Visual C++ 6.0 with a 64-Bit Build Environment-

1. In the the same command window where you set the environment

settings for 64-bit SDK, open Visual Studio.

2. Type "Msdev /useenv" (without the quotation marks). Do not open a

new command window to open MSdev.exe.. The Visual C++ 6.0 IDE is

displayed, but the include, the library, and the executable directories


are set for a 64-bit build environment. Note If Msdev.exe is not in the


path, change the folder to the \Microsoft Visual

Studio\Common\Msdev98\Bin folder before you run Msdev.exe.



Add a 64-Bit Debug Configuration-

1. In the Visual C++ IDE, open an existing 32-bit project (for example,


MyApplication).

2. On the "Build" menu, click "Configurations".

3. In the "Configurations" dialog box, click "Add".

4. In the "Add Project Configuration" dialog box, set "Configuration"

to Debug64, and then click "MyApplication? Win32 Debug" in the "Copy

Settings from" list.

5. To add the configuration, click "OK", and then click "Close".



Set the Active Configuration to 64 Bits

1. On the "Build" menu, click " Set Active Configuration".

2. Click "MyApplication- Win32 Debug64", and then click "OK".



Modify Compiler or Linker Options

Several Visual C++ 6.0 compiler or linker options do not apply to

the 64-bit compiler or to the linker. To modify these options,

follow these steps:

1. On the "Project" menu, click "Settings".

2. In the "Project Settings" dialog box, click the "General" tab. Under


"Output directories", type "Debug64" (without the quotation marks) in

the "Intermediate files" and "Output files" boxes.

3. On the "C/C++" tab, select "Program Database (compiler option, /Zi)"


in the "Debug info" list.

4. On the "Link" tab, change "/machine:I386" (without the quotation

marks) to "/machine:IA64" (without the quotation marks) in the "Project


options" box.

5. On the "View" menu, click "Workspace".

6. To delete the MyApplication.hpj file from the project, click the

"MyApplication.hpj" file in the Workspace window, and then press DEL.

Note This file may already be removed.

7. If your application is an MFC application, you must add an

MFC path to avoid receiving Linkers Tool Error LNK1104 on the

Mfc42d.lib

file. To add an MFC path, follow these steps:

a. On the "Tools" menu, click

"Options".

b. On the "Directories" tab, select

"Library Files" in the "Show directories" list.

Add the "\Microsoft SDK\lib\IA64\mfc" (without the

quotation marks) path if it is not

listed.



Build and Then Debug the Project

1. Build the project. Now you have a 64-bit application that is ready

to be deployed to an IA64 computer.

2. To run the .exe file from the Visual C++ 6.0 IDE, follow these

steps:

Note You cannot debug the .exe file from the Visual C++ 6.0 IDE.

a. Create a folder that is named C:\VC6MSVCMON on the

IA64 computer. Copy the following files from the x86

computer to this new

folder:

- Msvcmon.exe

- Dm.dll

- Msdis110.dll

- Tln0t.dll
These files are located in the

\VisualStudio\Common\MSDev98\Bin

folder.

b. After you copy the files, run Msvcmon.exe on the IA64

computer, and then click "Connect".

c. In the Visual C++ 6.0 IDE on the x86 computer, click

"Debugger Remote Connection" on the "Build" menu.

d. In the "Remote Connection" dialog box, click

"Network TCP/IP", and then click "Settings".

e. In the "Target computer name or address"

box, type the name of the IA64 computer. To close the

dialog box, click

"OK" two times.

f. In the Visual Studio C++ IDE, click

"Settings" on the "Project" menu. In the left pane,

expand "MyApplication", and then click the

"Debug" tab. You will notice that the "Executable for

debug session" box contains the path of

MyApplication.exe. This will be

C:\<X86Path>\MyApplication.exe.

g. In the "Remote executable path and file

name" box, type "MyApplication.exe" (without the

quotation marks) with a full path. This full path looks like

"\\<X86ComputerName>\C$\<x86Path>\MyApplication.exe"

(without the quotation marks).

Click "OK" to close the window.

h. To run the .exe file, press CTRL+F5 or click "Execute

MyApplication.exe" on the "Build" menu. The .exe file

runs on

the IA64 computer.

Note If MyApplication is an MFC application and if the project uses

MFC .dll files, make sure that the .dll files are copied from the

\Microsoft

SDK\NoRedist\Win64 folder to the \System32 folder on the IA64

computer. These

are the .dll files:

- Mfc42d.dll

- Mfco42d.dll

- Msvcrtd.dll

This folder also contains the symbols for the MFC, the ATL, and

the MSVCRT debug and release versions.



Build a 64-Bit Application by Using the Visual C++ .NET IDE

------------------------------------------------------------

Warning Do not install the 64-bit version of the WinDbg debugging tool


on the same computer where Visual Studio .NET is installed. For more

information about the 64-bit version of WinDbg,

read the Platform SDK 64-bit Readme. The Readme is located at

C:\Program

Files\Microsoft SDK\Bin\Win64\Readme.doc.

Set the 64-Bit Build Environment

Variables

To set the 64-bit build environment variables, use either of the
following

methods:

- Click "Start", point to "Microsoft Platform SDK", point to "Open

Build Environment Window", point to "Set Windows XP 64 Build

Environment", and then click "Set Windows XP 64 Build Environment

(Debug)". A console window with the build environment set for a 64-bit


build is displayed.

- To set the 64-bit environment variables at the command

prompt, follow these steps:

1. Click "Start", and then click

"Run".

2. Type "command.exe" (without the quotation marks), and then click

"OK".

3. Change the folder to the \Microsoft SDK folder, and

then type "SetEnv.bat /XP64" (without the quotation

marks).



Start Visual C++ .NET with a 64-Bit Build Environment

1. In the the same command window where you set the environment

settings for 64-bit SDK, open Visual Studio .NET.

2. Type "devenv /useenv" (without the quotation marks), and then click


"OK". The Visual C++ .NET IDE with the include, the library, and the

executable directories set for a 64-bit build environment is displayed.


Note If Devenv.exe is not in the path, change the folder to the

<InstallationFolder>\Microsoft Visual Studio .NET\Common7\IDE folder

before you run Devenv.exe. Warning After you run this command, every

console window or Visual Studio .NET IDE that you open has the 64-bit

build environment. If you want to clear the environment, delete the

Vccomponents.dat file from the C:\Documents and

Settings\<Username>\Local Settings\Application

Data\Microsoft\VisualStudio\7.0 folder before you open a new console

window or a new Visual Studio .NET IDE.



Add a 64-Bit Debug Configuration

1. Open an existing 32-bit project (for example, MyApplication).

2. On the "Build" menu, click " Configuration Manager".

3. In the "Active Solution Configurations" list, click "New".

4. In the "New Solution Configuration" dialog box, select "Debug64"

(without the quotation marks) under "Solution Configuration Name", and


then select "Debug" under "Copy Settings From".

5. Click "OK".

6. In the "Configuration Manager" dialog box, click to select "Debug64"


in the "Active Solution Configuration" list, and then click "OK".



Modify Compiler or Linker Options

Several Visual C++ .NET compiler or linker options do not apply

to the 64-bit compiler or linker. To modify these options, follow

these steps:

1. In Solution Explorer, right-click "Project", and then click

"Properties".

2. In the "C/C++" node, select "General". Set "Debug Information

Format" to "Program Database (compiler option, /Zi)".

3. In the "C/C++" node, select "Code generation". Set "Buffer Security


Check" to "No (compiler option, /GS)".

4. In the "Linker" node, select "Command Line". Under "Additional

Options", add "/MACHINE:IA64" (without the quotation marks).

5. If your application is an MFC application, you must add an

MFC path to avoid receiving Linkers Tool Error LNK1104 on the

Mfc42d.lib

file. To add an MFC path, follow these steps:

a. On the "Tools" menu, click

"Options".

b. Under "Projects", select "VC++

Directories". On the "Show directories" list, select

"Library Files". If it is not listed, add the

"\Microsoft SDK\lib\IA64\mfc" (without the quotation

marks) path. Note If MyApplication is an MFC application and the
project

uses MFC .dll

files, make sure that the .dll files are copied from the

\Microsoft

SDK\NoRedist\win64 folder to the \System32 folder on the IA64

computer. These

are the DLLs:

- Mfc42d.dll

- Mfco42d.dll

- Msvcrtd.dllThis folder also contains the symbols for the MFC, ATL,
and

MSVCRT debug and release versions.



Build the Project

Build the project. Now you have a 64-bit application that is ready

to be deployed to an IA64 computer.

Note Although you can run the .exe file from Visual C++ 6.0 IDE, you

cannot, you cannot run the .exe file from the

Visual C++ .NET IDE. Also, you cannot debug the .exe file from the

Visual C++ .NET

IDE.

Joseph M. Newcomer wrote:
> Sorry to say, but you cannot say "have to do it in VC6". There is NO 64-bit compiler and
> no way to create a 64-bit app in VC6, and all the wishing in the world is not going to
> make it happen.
> joe
>
> On 7 Aug 2005 21:14:22 -0700, "prasoon" <prasoonchaturvedi@xxxxxxxxx> wrote:
>
> >thanks for reply. but i hv to do it in vc6. i hv PSDK feb 2003 edition.
> >
> >Mercury wrote:
> >> get an eval copy of vc8 public beta.
> >> this will be the best platform to do 64bit stuff.
> >> you should be able to order the beta discs @msdn online.
> >>
> >> you are heading in the right direction afaik...
> >>
> >> BOL.
> >>
> >>
> >> "prasoon" <prasoonchaturvedi@xxxxxxxxx> wrote in message
> >> news:1123221094.641347.191390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >> >I am porting my 32-bit code on 64-bit intel xeon processor m/c. I
> >> > searched many documents. I build successfully 64-bit binary. but when i
> >> > ran it on Xeon m/c it says that it is a valid image file but for some
> >> > other machine ie system error 216.
> >> >
> >> > I am giving "/machine:IA64" in the link settings. i explored the net i
> >> > reached on conclusion that IA64 is for intel itanium. for xeon it
> >> > should be "X64" or something else. when i give "X64" in the setting the
> >> > compiler doesnt recognises it n ignores it. i am using vc6 with
> >> > platform sdk feb 2003 edition. after that the support for vc6 hv been
> >> > ended.
> >> >
> >> > can anyone suggest me what i have to do to build 64-bit binary for
> >> > intel xeon.
> >> >
> >> > if the support for vc6 hv been ended so would v not be able to build
> >> > applications for future versions of 64-bit h/w's or many be forthcoming
> >> > 128/256 bit h/w's.
> >> >
> >> > thanks in advance
> >> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@xxxxxxxxxxxx
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm

.



Relevant Pages

  • RE: VS6 and intel C++ 8.0 - how to compile for WIN64?
    ... Because the native 64-bit IDE is still under ... #toc: back to the ... To set the 64-bit build environment variables, ... Build Environment Window", point to "Set Windows XP 64 Build ...
    (microsoft.public.vstudio.general)
  • Re: porting 32-bit to 64-bit on Xeon
    ... IDE to build 64-bit applications while you maintain the same code base ... Set the 64-Bit Build Environment ... Build Environment Window", point to "Set Windows XP 64 Build ... change the folder to the \Microsoft Visual ...
    (microsoft.public.vc.language)
  • Re: porting 32-bit to 64-bit on Xeon
    ... > Set the 64-Bit Build Environment ... > Build Environment Window", point to "Set Windows XP 64 Build ... > Add a 64-Bit Debug Configuration- ... > to be deployed to an IA64 computer. ...
    (microsoft.public.vc.mfc)
  • Need help ASAP. Problems importing a form
    ... I work with a test database environment to develop or ... to the production db by opening the production db front ... Objects' window opened, I selected the form to import. ... I have been using this 'develop and import' environment ...
    (microsoft.public.access.externaldata)
  • Re: Temp directory and directory of the .exe file.
    ... In any kind of shared environment, it means that every user gets to inherit the most ... Or exercise good judgment and put it in a protected folder? ... And it doesn't work if you put the executable in a shared network folder for everyone to ... or in a shared folder used by multiple VMs. ...
    (microsoft.public.vc.mfc)

Quantcast