views:

323

answers:

1

I am trying to get a definitive answer regarding the way COM behaves on a x64 machine. Does Windows use the normal x64 calling convention when dispatching calls to COM interfaces on x64 machines (assuming the COM implementation is 64 bits)? Specifically, I dynamically generate my vtbl entries to point to a chunk of assembly that's dynamically loaded during runtime. This assembly needs to know how to get parameters correctly from whomever is calling it. Thus, I'd like to know if COM sets up the call to my assembly using the standard x64 calling convention (pretty much fastcall).

+4  A: 

The COM calling convention is whatever the STDMETHOD/STDMETHODIMP macros (and their variants) defines it to be. On IA-32, it's stdcall for most of them; I do not know what is used on x86-64 (I only have the 32-bit mingw cross-compiler installed).

CesarB
stdmethod resolves to nothing when compiling for amd64. So I'd assume the COM calling convention on x64 is the normal x64 calling convention, even when windows dispatches the call?
Zach
It's probably the normal Windows x86-64 method calling convention (which might be different from the calling convention for non-methods).
CesarB
x64 has a unique way call convention : [fastcall](http://blogs.msdn.com/oldnewthing/archive/2004/01/14/58579.aspx)
lsalamon