views:

40

answers:

2

Hi, all

My compile environment is windows xp and vc 6.0.

Now I have a c source file(msgRout.c), def file(msgRout.def), link file(msgRout.link), then I use commands below to get a 32 bit dll:

1.cl /I ../include -c -W3 -Gs- -Z7 -Od -nologo -LD -D_X86_=1 -DWIN32 -D_WIN32 -D_MT -D_DLL msgRout.c

2.lib -out:msgRout.lib -def:msgRout.def -machine:i386

3.link /LIBPATH:../../Lib -nod -nologo -debug:full -dll @msgRout.link -out:msgRout.dll

But the dll I got cannot be loaded on X64 application. it required a 64 bit dll.

So here is my question: Can I get a 64 bit dll with vc 6.0? Using only above 3 commands alike, how can I get 64 bit dll?

Many GREAT THANKS!!!

Allan

+1  A: 

Visual C++ 6.0 does not include 64-bit compiler/libraries. You will need either a more recent version of Visual C++ or a Windows Platform SDK that has the 64-bit support. The earliest one is the Windows Server 2003 Platform SDK.

Once you have that installed, cl /? and link /? will have info on how to build 64-bit apps.

Update: If you have VS2005, you can build 64-bit binaries with the x86-amd64 cross-compiler (a 32-bit cl.exe that produces 64-bit code) or with the x64 compiler (a 64-bit cl.exe). To do that, you need to:

  • Make sure you've installed the 64-bit tools support during VS installation.
  • Open a command line and set it for x86-amd64 builds using C:\Program Files\Microsoft Visual Studio 8\VC\Vcvarsall.bat x86_amd64 or
  • (on 64-bit Windows) Open an x64 command line and set it for 64-bit builds using C:\Program Files\Microsoft Visual Studio 8\VC\Vcvarsall.bat amd64.

Once you do that, you should be able to use the same command line as above (with tcouple small changes - for cl you'll have to define /D:X64=1 or /D_AMD64_ and for link you'll have to change the /machine:x86 to /machine:x64) to produce 64-bit version of your program.

Here are some links with more information:

Installing Visual Studio 64-bit Components
HowTo: Enable a 64-Bit Visual C++ Toolset at the Command Line
Use Visual Studio to build 64-bit application
64-bit Applications
Seven Steps of Migrating a Program to a 64-bit System

Franci Penov
Sorry, normally I'd give you exact cl/link command line, but I am on my iPhone right now w/o access to a PC.
Franci Penov
Franci, could you provide exact cl, lib, link command line later, please? I got VS2005 (and VS2008) now, I think they could compile 64 bit dll? Thank you.
allan
Your command is very helpful, you helped me a lot! Thank you very much!
allan
A: 

You cannot. Microsoft does not have time machines.

Joshua
You obviously are not aware of some of the latest MS Research projects... :-)
Franci Penov