calling-convention

When to use calling conventions

What are the key factors on using different calling conventions? When does someone know to use specific calling conventions such as __cdecl or __stdcall or __fastcall in different occasions. Examples would be really apprciated. ...

Why are there so many different calling conventions?

Historically, why does it seem like just about everyone and their kid brother defined their own calling conventions? You've got C, C++, Windows, Pascal, Fortran, Fastcall and probably a zillion others I didn't think to mention. Shouldn't one convention be the most efficient for the vast majority of use cases? Is there ever any good re...

Changing Calling convention from cdecl to stdcall

In VS2005, I was using _cdecl calling convention and the project builds without any linker errors. After I change the calling convention to _stdcall while porting the project to VS2008, I get the following error: error LNK2001: unresolved external symbol _imp_GCBOpen@8. Configuration Settings>C\C++>Genral>Common Language Runtime suppor...

Getting confuse with ABI calling convention and arch

Hi, I am getting confuse with all those terms: ABI, calling convention, and hardware architecture. The ABI is link with the architecture: x86-64 have a different ABI than the i386. But then you can also define your own calling convention cdecl... Well so what is the link between all those concept? Which one is defining the other one...

Why did Microsoft choose stdcall as their API convention?

Is there a good reason? Are their internal functions (not exported) also stdcall convention? ...

Can stdcall have a variable arguments?

As far as I know, only the caller-clean-stack convention can use variable arguments. By the way, the WinApi StringCchPrintfW is declared like this.(I removed the SAL) _inline HRESULT _stdcall StringCchPrintfW( STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, ... ); Can stdcall have a variable arguments eithe...

printf: how to explain corrupted result

#include <stdio.h> int main(void) { double resd = 0.000116; long long resi = 0; printf("%lld %f %lld %f\n", resd, resd, resi, resi); return 0; } gives (Linux, gcc, x64) 0 0.000116 0 0.000116 ^^^^^^^^ odd, since the memory for resi is zeroed Actually, compiled with g++ it gives random r...

How to return a complex return value?

Hi awesomes~ Currently I am writing some assembly language procedures. As some convention says, when I want to return some value to the caller, say an integer, I should return it in the EAX register. Now I am wondering what if I want to return a float, a double, an enum, or even a complex struct. How to return these type of values? I c...

How to investigate the calling convention of PE binary file in windows?

Is there a tool to show whether the calling convention is _cdecl or _stdcall or else? ...

Help understanding x86-64 function preamble

I am experiencing a crash, and while investigating I found myself totally blocked by the following code: 0000000000000a00 <_IO_vfprintf>: a00: 55 push %rbp a01: 48 89 e5 mov %rsp,%rbp a04: 41 57 push %r15 a06: 41 56 push %r14 a08: ...

Automatic calling functionality (Dialer + IVR + Text to Speech)

Hi friends, i have a scenario where i have to use the automatic calling functionality using VOIP (Diagrammatically). I need a system or dialler that will automate the process of dialling and get response through the system. We need a tool that could be able to dial by itself (we don’t have any agent interaction) the given number and wi...

How do I wrap a non-standard calling convention in C?

Without getting into specifics, say I need to make use of a non-standard calling convention from C code. Functions that use this convention may return multiple values on the stack. It would be simple to put each function in a wrapper that uses inline assembly to make the call, sending output via pointer parameters given to the wrapper. U...

Is it a convention to avoid using $_ when using other people's Perl API's?

I've just been caught out when using someone else's API in conjunction with the default variable $_ foreach (@rps_server_details) { @server_data = (); @server_data = split(/,/); @$esp_hosts = (); $filters{server_name} = $server_data[0]; print "--->$_<--\n"; $esp_hosts = $esp->get_hosts(fields => $fields, %filters...