_stdcall and __cdecl

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
what is the difference between _stdcall and __cdecl, is the stack
release issue much important.. and why other languages like java are not
worrying about these things.. any idea..

-Pugal
 
what is the difference between _stdcall and __cdecl, is the stack
release issue much important.. and why other languages like java are not
worrying about these things.. any idea..

one issue is that __cdecl supports functions with a variable number of
arguments, while _stdcall does not.
the reason is that with Stdcall, the callee has to pop arguments from the
stack. with varargs this cannot work since the callee cannot know what was
put on the stack in the first place.

another issue is that naming convention is different.

This page has a nice summary of the different calling conventions and their
differences:
http://msdn.microsoft.com/library/d...e_argument_passing_and_naming_conventions.asp

calling conventions are usually important if you are working with external
code,
because the other party needs to know how to call your functions.

for example, if you create a thread with _beginthreadex, the thread function
has to follow stdcall, while thread functions strated with _beginthread have
to follow __cdecl.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Hi Bruno

I'm quite clear right now about _stdcall and __cdecl, thank you for your
answer.

-Pugal
 
Back
Top