Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / July 2006

Tip: Looking for answers? Try searching our database.

_stdcall  and __cdecl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pugal - 07 Jul 2006 11:03 GMT
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
Bruno van Dooren - 07 Jul 2006 12:40 GMT
>     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/default.asp?url=/library/en-us/vccore98/HTML/_
core_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.

Signature

Kind regards,
   Bruno van Dooren
   bruno_nos_pam_van_dooren@hotmail.com
   Remove only "_nos_pam"

Pugal - 07 Jul 2006 14:41 GMT
Hi Bruno

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

-Pugal

> >     what is the difference between _stdcall  and __cdecl, is the stack
> > release issue much important.. and why other languages like java are not
[quoted text clipped - 19 lines]
> has to follow stdcall, while thread functions strated with _beginthread have
> to follow __cdecl.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.