473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

_stdcall and __cdecl

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
Jul 7 '06 #1
2 3498
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/de...onventions.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
br**********************@hotmail.com
Remove only "_nos_pam"
Jul 7 '06 #2
Hi Bruno

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

-Pugal

"Bruno van Dooren" wrote:
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/de...onventions.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
br**********************@hotmail.com
Remove only "_nos_pam"
Jul 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pawel | last post by:
Hi! I have a .dll library, with some exported function, which looks something like this: extern "C" { int exported_f (int (__cdecl *callback) (int a, int b)) ; } now, I want to invoke this...
6
by: Sagar Choudhary | last post by:
I m using a library function which need to be passed a function as parameter. If i declare the function as int (void *, int, char **, char **) it throws an error cannot convert parameter from...
12
by: Sydex | last post by:
When I compile code I get error C2664: 'Integration::qgaus' : cannot convert parameter 1 from 'double (double)' to 'double (__cdecl *)(double)' in this part : double Integration::quad2d(double...
3
by: vinu_gt | last post by:
Hi All, I had a question about stdcall and cdecl calling convention related to Visual Studio 6.0 I have a console project and in Project->setting->C++->Code Generation The "calling...
1
by: edx | last post by:
Hi, compiling my class library with Managed C++, I get this: error LNK2001: unresolved external symbol "void __cdecl __CxxCallUnwindDtor(void (__thiscall*)(void *),void *)"...
5
by: kwijibo28 | last post by:
Hi all, I was wondering if there is a standard definition for the calling convention like __cdecl and __stdcall. I've search the c++ standard document and there is no mention of __cdecl or...
1
by: happiness4all | last post by:
dt.h #ifndef INDLL_H #define INDLL_H #ifdef EXPORTING_DLL extern __declspec(dllexport) char* Summ(char*); #else extern __declspec(dllimport) char*...
2
by: Virtual_X | last post by:
i am beginner to c++ when i open the file "stdio.h" i have found the line _CRTIMP int __cdecl remove (const char*); and similar lines to it so what's "_CRTIMP" and "__cdecl"
6
by: Ole Nielsby | last post by:
VC has a __cdecl specifier which allows functions and methods to be called with varying parameter count. (I understand this is the default for functions in general but in VC, instances use...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.