flat assembler
Message board for the users of flat assembler.

Index > Windows > how to know when cdecl?

Author
Thread Post new topic Reply to topic
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
Hy guys,
How to know when the functions from a library is stdcall or cdecl?

in some examples I see:
cinvoke system, XXXXX

and in thers... stdcall system, PAUSE


in the case of system, its from mvcrt, debuging its obvious it is cdcel.

But for example, wsprintf is cdecl
Quote:

int __cdecl wsprintf(
__out LPTSTR lpOut,
__in LPCTSTR lpFmt,
__in ...
);
from msdn

And its located in a library where almoste every function is stdcall.




so the question is, how to know when to use stdcall and when to use cdcel Without debugging ?

is there some other method then just guessing like
mvcrt.dll c runtime, should be cdecl
user32.dll winapi, should be stdcall
Post 04 Jul 2011, 21:02
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
- ret xxxx
- documentation
Post 04 Jul 2011, 21:24
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
I have the entire msdn library docs on disk for ref.
Another good ref is the C standard library headers.
Since we are in Windows sub-forum then i also say
that the only ones are cdecl is stdarg type procs.
Post 05 Jul 2011, 02:37
View user's profile Send private message Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
"ret xxxx"?
Post 05 Jul 2011, 23:36
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
mindcooler wrote:
"ret xxxx"?

retn 4, retn 8, etc.... is stdcall, the called procedure cleans the stack.
Post 06 Jul 2011, 00:20
View user's profile Send private message Reply with quote
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu
it's documented in the msdn, you could also see c headers
additionally procedures which accept a variable amount of parameters are mostly cdecl
Post 07 Jul 2011, 17:24
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.