Connecting Tech Pros Worldwide Help | Site Map

stdcall and __cdecl

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 05:50 AM
vinu_gt@yahoo.com
Guest
 
Posts: n/a
Default stdcall and __cdecl

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 convention" is __cdecl.
1) Does this mean that function calls(meaning i call a function in my
program or a function in a dll)
in my program will assume that the called functions have been compiled
with __cdecl calling standard and as
such use __cdecl convention to call those functions.
Or
2) Does it mean that "by default" the functions in my program will be
constructed with __cdecl calling convention.

Does it work the same way on both windows and unix.

Could you also kindly direct me to some nice article which explains
this in detail.

Thanks
Vinu


  #2  
Old July 23rd, 2005, 05:50 AM
John Carson
Guest
 
Posts: n/a
Default Re: stdcall and __cdecl

<vinu_gt@yahoo.com> wrote in message
news:1120488687.922465.68610@z14g2000cwz.googlegro ups.com[color=blue]
> Hi All,
>
> I had a question about stdcall and cdecl calling convention related to
> Visual Studio 6.0[/color]

Any questions that look like they may be Microsoft specific (like this one)
are better asked in

microsoft.public.vc.language
[color=blue]
> I have a console project and in Project->setting->C++->Code Generation
> The "calling convention" is __cdecl.
> 1) Does this mean that function calls(meaning i call a function in my
> program or a function in a dll)
> in my program will assume that the called functions have been compiled
> with __cdecl calling standard and as
> such use __cdecl convention to call those functions.
> Or
> 2) Does it mean that "by default" the functions in my program will be
> constructed with __cdecl calling convention.[/color]

It means that any function will be assumed to use the __cdecl convention
unless the function prototype indicates otherwise. Function declarations in
windows file header almost always *will* indicate otherwise, usually via
macros like CALLBACK or WINAPI.
[color=blue]
> Does it work the same way on both windows and unix.[/color]

Don't know.
[color=blue]
> Could you also kindly direct me to some nice article which explains
> this in detail.[/color]

Type in stdcall or cdecl in your compiler help file and you should get some
hits. Or do likewise at

http://msdn.microsoft.com/library/default.asp


--
John Carson

  #3  
Old July 23rd, 2005, 05:50 AM
Larry I Smith
Guest
 
Posts: n/a
Default Re: stdcall and __cdecl

vinu_gt@yahoo.com wrote:[color=blue]
> 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 convention" is __cdecl.
> 1) Does this mean that function calls(meaning i call a function in my
> program or a function in a dll)
> in my program will assume that the called functions have been compiled
> with __cdecl calling standard and as
> such use __cdecl convention to call those functions.
> Or
> 2) Does it mean that "by default" the functions in my program will be
> constructed with __cdecl calling convention.
>
> Does it work the same way on both windows and unix.
>
> Could you also kindly direct me to some nice article which explains
> this in detail.
>
> Thanks
> Vinu
>[/color]

http://msdn.microsoft.com/library/de...onventions.asp

Note the differences under the "Stack cleanup" column.

Click the links (__cdecl, __stdcall, etc) for details of each.

Larry
  #4  
Old July 23rd, 2005, 05:50 AM
Larry I Smith
Guest
 
Posts: n/a
Default Re: stdcall and __cdecl

Larry I Smith wrote:[color=blue]
> vinu_gt@yahoo.com wrote:[color=green]
>>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 convention" is __cdecl.
>>1) Does this mean that function calls(meaning i call a function in my
>>program or a function in a dll)
>>in my program will assume that the called functions have been compiled
>>with __cdecl calling standard and as
>>such use __cdecl convention to call those functions.
>>Or
>>2) Does it mean that "by default" the functions in my program will be
>>constructed with __cdecl calling convention.
>>
>>Does it work the same way on both windows and unix.
>>
>>Could you also kindly direct me to some nice article which explains
>>this in detail.
>>
>>Thanks
>>Vinu
>>[/color]
>
> http://msdn.microsoft.com/library/de...onventions.asp
>
> Note the differences under the "Stack cleanup" column.
>
> Click the links (__cdecl, __stdcall, etc) for details of each.
>
> Larry[/color]

Here's two more articles that summarize it well:

http://www.unixwiz.net/techtips/win32-callconv-asm.html
http://www.unixwiz.net/techtips/win32-callconv.html

Larry
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.