The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: ToutEnMasm on January 27, 2008, 04:14:27 PM

Title: c++ call and masm call
Post by: ToutEnMasm on January 27, 2008, 04:14:27 PM
Hello,
I want to know the translation of each c++ call in masm call.

__cdecl   is   'PROTO C'   in masm
__clrcall
__stdcall   'PROTO'   
__fastcall
__thiscall  'PROTO + 1 dword'

Masm offer this call

C, SYSCALL, STDCALL, PASCAL, FORTRAN, or BASIC.

By what can be translate the __clrcall  and __fastcall in masm ?





Title: Re: c++ call and masm call
Post by: MichaelW on January 27, 2008, 07:07:57 PM
The conventions for __fastcall are straightforward, but they vary with the compiler:

http://en.wikipedia.org/wiki/Fastcall

The _clrcall convention is Microsoft specific, and in the short time I spent looking I could not find any detailed information. Apparently a function can have both native and managed entry points, but I did not find any statement that the native entry point will always be present.

http://msdn2.microsoft.com/en-us/library/ec7sfckb.aspx

Title: Re: c++ call and masm call
Post by: jdoe on January 27, 2008, 08:14:39 PM
ToutEnMasm,

http://blogs.msdn.com/oldnewthing/archive/2004/01/08/48616.aspx


__cdecl  :  PROTO C



__stdcall  :  PROTO STDCALL



__clrcall  :  I have no idea



__fastcall  : I think it just can't be done with MASM but the workaround is like this

Win32...
EXTERNDEF SYSCALL @Dns_ReadPacketName@28:PROC
Dns_ReadPacketName EQU <@Dns_ReadPacketName@28>

On Win64 platform, everything is like...
EXTERNDEF Dns_ReadPacketName:PROC



__thiscall  :  ECX + PROTO STDCALL (only a guess)