build C++ COM for 64-bit platform

G

Guest

Thanks David,


I think from your reply, I should make two builds for 32-bit DLL and 64-bit
DLL since the application which uses the DLL maybe 32-bit and 64-bit.

I am wondering whether there are any tool to check whether an application
(binary code) is 32-bit or 64-bit?


regards,
George
 
N

Norman Diamond

In my latest experiment, in the project properties where some preprocessor
identifiers are defined, MSDN says that identifier WIN32 is replaced by
identifier WIN64 automatically, but Visual Studio 2005 does not do so.

In my latest experiments, in the project properties for C++, I kept the
setting of WIN32 and added additional definitions of both WIN64 and _WIN64.
_WIN64 affects some include files so that some datatypes will be correct for
64-bit execution. I don't know if it's necessary to keep WIN32 defined
and/or define WIN64 the same way, but so far they haven't caused any visible
problems.

In my latest experiments, in the project properties for MIDL, I didn't add
definitions of WIN64 and _WIN64. As far as I can tell, this omission causes
Visual Studio 2005 to display inappropriate portions of some MIDL include
files, but MIDL compilation seems to be correct for 64-bit execution. As
far as I can tell, this is because Visual Studio 2005 automatically added a
different MIDL compilation option, which isn't documented in MSDN but which
seems to work halfway.

The problem with the C# client trying to retrieve IntPtr values (working in
32-bits but failing to compile in 64-bits) has remained unchanged in all of
these experiments.
 
W

Willy Denoyette [MVP]

George said:
Thanks David,


I think from your reply, I should make two builds for 32-bit DLL and
64-bit
DLL since the application which uses the DLL maybe 32-bit and 64-bit.

I am wondering whether there are any tool to check whether an application
(binary code) is 32-bit or 64-bit?

Check the dumpbin utility in VS2005 or in the Windows SDK.
dumpbin /headers ... will show you all this and more.
Willy.
 
G

Guest

Thanks Norman,


What is the differences between WIN64 and _WIN64? Any official documents?


regards,
George
 
G

Guest

Hi Willy,


I have tried dumpbin. Here is result,

Do you mean this line indicate it is 32-bit? I do not have a 64-bit DLL at
hand so I do not know what is the output for 64-bit DLL,

32 bit word machine

here is the total output

14C machine (x86)
3 number of sections
471755F1 time date stamp Thu Oct 18 20:47:45 2007
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL


regards,
George
 
W

Willy Denoyette [MVP]

George said:
Hi Willy,


I have tried dumpbin. Here is result,

Do you mean this line indicate it is 32-bit? I do not have a 64-bit DLL at
hand so I do not know what is the output for 64-bit DLL,

32 bit word machine

here is the total output

14C machine (x86)
3 number of sections
471755F1 time date stamp Thu Oct 18 20:47:45 2007
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
210E characteristics
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
DLL

This is a native 32bit module, as indicated by :
14C machine (x86)

A 64bit module includes this:
8664 machine (x64)

in the header.

Willy.
 
G

Guest

Thanks Willy,


Your reply is very helpful. I want to check that when people mentioned *x86*
it seems that it is for 32-bit only, and there is no x86-64bit, right?

And also when people mentioned *x64* it seems that it is for 64-bit only,
and there is no x64-32bit, right?


regards,
George
 
D

David Lowndes

Your reply is very helpful. I want to check that when people mentioned *x86*
it seems that it is for 32-bit only, and there is no x86-64bit, right?

x86 usually means Intel 80x86/Pentium/etc. style 32-bit architecture.
x64 usually means the 64-bit x86 architecture - as opposed to Itanium
IA64 architecture.

Dave
 
G

Guest

Thanks Dave,


I am clear now.


regards,
George

David Lowndes said:
x86 usually means Intel 80x86/Pentium/etc. style 32-bit architecture.
x64 usually means the 64-bit x86 architecture - as opposed to Itanium
IA64 architecture.

Dave
 
N

Norman Diamond

I haven't seen any documents on the intended meanings of these preprocessor
symbols, only one document (already mentioned) with a false assertion that
this conversion will be applied automatically.

I saw some source code in Microsoft's headers which depended on _WIN64 being
defined. I don't know if some other source code might depend on WIN64 being
defined. In my latest experiments, I defined both, and also kept the
existing definition of WIN32 (the one which a document falsely asserted
would be converted), and haven't seen any ill effects from this combination
of three definitions. Of course this is only for x64 builds.
 
B

Ben Voigt [C++ MVP]

George said:
Thanks Willy,


Your reply is very helpful. I want to check that when people mentioned
*x86*
it seems that it is for 32-bit only, and there is no x86-64bit, right?

And also when people mentioned *x64* it seems that it is for 64-bit only,
and there is no x64-32bit, right?

There are several names used interchangably (the minor differences aren't
important for user-mode Windows programs):

32-bit: x86, i386, i486, i586, i686
64-bit: AMD64, EM64T, x64, x86_64 <- this last one is potentially confusing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top