Re: calling convention
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Tue, 24 Feb 2009 11:09:02 +0100
Lisa Pearlson wrote:
I understand difference between __cdecl and __stdcall is who does cleanup,
the caller or callee.. correct?
Yes. Other differences might be the order in which function arguments are
pushed onto the stack. In general, it describes the protocol with which the
caller and callee communicate, be it via the stack or registers.
If you do not explicitly specify the calling convention, the default seems
to be __cdecl, yet all windows dll's use __stdcall. So is the latter only
interesting for DLLs?
No.
Can one type call another type? e.g.:
BOOL __cdecl MyCdeclFn()
{
return TRUE;
}
BOOL __stdcall MyStdFn()
{
return MyCdeclFn();
}
I guess not.. I get an error when I try this.
Which error? I don't get any.
And which calling convention is used when you LoadLibrary a DLL and then
use GetProc ? I've always done this with windows dll's as well as my own,
without consideration of calling convention..
You can also use GetProcAddress() to retrieve the address of an object.
Calling a function requires that you use the right calling convention, but
there is nothing that will help you with that, you must manually achieve
consistency.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
.
- References:
- calling convention
- From: Lisa Pearlson
- calling convention
- Prev by Date: Re: calling convention
- Next by Date: CreateFile API and UTF-8 encoding
- Previous by thread: Re: calling convention
- Next by thread: String constant's "constness"
- Index(es):
Relevant Pages
|