views:

317

answers:

3

Hi all,

Probably a dumb question: I have a WinXP 32bits desktop that I use to compile a (32 bits) dll with Visual Studio 2005/Intel COmpiler 10.1. I would like to generate a 64 bits version of my dll. How to do that? Answers related to Visual Studio are interesting, but those addressing the Intel compiler side of things get extra brownie points.

Thanks in advance.

ALex

+1  A: 

This little guide I made is to make t**he VC++ 2005 Express compile 64bit using the latest PSDK** (altough I'm not sure how good it works)

I'll assume you already have VC++ 2005 Express and the PSDK installed, and activated the Win32 application building in VC++ and running 64bit Windows (well it maybe works in 32bit windows too but the exe will not run in that enviroment)

1) Start -> All Programs -> Microsoft Platform SDK for Windows Server 2003 SP1 -> Windows XP 64-bit Build Environment -> Set Windows XP x64 Build Environment (Debug/Retail) <- doesn't mather which one at this moment

2) start the VC++ 2005 Express IDE run the VCExpress.exe file with the /USEENV swich: [your install dir of VC++ 2005 Express]\Common7\IDE\VCExpress.exe /USEENV This will clear out all default bin/lib/include path and add only those that the 'Set Windows XP x64 Build Environment (Debug/Retail)' batch file sets for you.

3) Open your application or create a new one.

4) Edit the properties for the application ( Project -> Properties ) and change this settings to this values.

C/C++ -> General -> Debug Information Format : Program Database (/Zi) C/C++ -> Code Generation -> Basic Runtime Checks : Default Linker -> Advanced -> Target Machine : not set Linker -> Command Line -> Additional Options : /MACHINE:AMD64

now it should be able to compile for 64bit (I think I havn't forgotten anything)

altough I got this error: error PRJ0002 : Error result 128 returned from 'C:\Program Files\Microsoft Platform SDK\Bin\mt.exe'.

but solved it by copy the mt.exe that comes with the VC++ 2005 Express install to the PSDK/Bin dir, thus overwriting the PSDK/bin/mt.exe.

Another thing I almost forgot. you maybe get this error described here: http://support.microsoft.com/?id=894573 adding bufferoverflowU.lib to the project will solve that.

NOTE: I havn't tested it anything yet just compiled a simple windows app and a console app and the TaskManager doesn't say *32 after the process as it would do if it was 32-bit. I don't know if it works with larger projects or anything because I got it working for like 10 minutes ago :)

But I have a question about my newly created 64bit applications (just a simple "hello world" window created by the built in wizard) how can I be sure that it is really 64 bit? the Taskmanager says it is because it doesn't have the *32 but is that enough proof?

EDIT: you may need to copy the msvcrtd.dll & msvcp60d.dll from PSDK\NoRedist\Win64\AMD\ to where they belong (don't really know) I put them in Windows\System32

information take from http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/d0770dde-56e5-4a28-acb0-30908c0f7ebd Read this also :

http://www.codeproject.com/KB/system/64BitOSAndPortingIssues.aspx

joe
A: 

Select propeties on your project i solution explorer. Under Build - Platform, choose "Any CPU".

Andersson
I was going to say that, but then I noticed that C++ projects have a different properties page, and Build isn't there.
R. Bemrose
At least it wasn't in the MFC Project settings. I didn't check the others.
R. Bemrose
Thanks for your notice, this answer should be removed if its useless?
Andersson
A: 

you can compile it directly in vs2005 or 2008 because of the attribute "any CPU" but cancel the attribute "com seen" if you have perhaps you should copy it to system32 instead of 64 and then RegAsm it

Edwin Tai