Questions tagged [cdecl]

Anything related to the `cdecl` calling convention, i.e. one of the common subroutine calling conventions used on systems with x86 architecture.

Anything related to the cdecl calling convention, i.e. one of the common subroutine calling conventions used on systems with x86 architecture.

See Wikipedia on:

101 questions
0
votes
1 answer

How to read and write a byte from and to stdin/stdout using Syscall in x86 with NASM assembler?

I am trying to read a string from stdin and print it back out using x86, NASM, and Syscalls. Reading in a byte will be a function, and writing out a byte will be a function. I am reading the string from stdin and putting each char into an array.…
CarrotSlat
  • 59
  • 1
  • 9
0
votes
1 answer

What are the variable names that are disallowed in cdecl other than the ones that cannot be used in any program?

I've been playing around with cdecl and I've noticed that some names are not allowed as identifiers in it although GCC compiles them perfectly. For example, if I write int ptr; or int pointer; or int array; cdecl gives a "syntax error" but…
Spikatrix
  • 20,225
  • 7
  • 37
  • 83
0
votes
3 answers

How do I compile boost using __cdecl calling convention?

I have a project compiled using __cdecl calling convention (msvc2010) and I compiled boost using the same compiler using the default settings. The project linked with boost but I at runtime I got an assert message like this: File:…
sorin
  • 161,544
  • 178
  • 535
  • 806
0
votes
1 answer

AccessViolationException when calling C function from dll on C#

I'm trying to use PInvoke in order to call an unmanaged function from a C dll. Due to the fact that the source of the dll can't be released to developers, some of them have called the function in Delphi using the following declaration. We use…
Levrak
  • 1
  • 3
0
votes
1 answer

__cdecl wrapping WinSock function as callback in plain C and call it

Have prepared such function, where some WSA functions will be used as callback: int StartWinSock(int (*WSAStartup)(WORD, LPWSADATA)) { } But when in other code, I'm trying to launch it: StartWinSock(WSAStartup); I'm getting an…
Secret
  • 2,627
  • 7
  • 32
  • 46
0
votes
2 answers

error C2664 due to cdecl and myclass conflict

I'm trying to join an old piece of code in C to my present VC++ project: // .h class DMSinv : public CDialog { double finte(double z); double ITFStolz(double Zp1, double Zp2, double Zc); }; // .cpp double Zcglob; …
madoro
  • 55
  • 7
0
votes
3 answers

Assembly language - Calling convention

Can someone give me some real example to help me understand what is the callee and what is the caller in assembly language? I have been through most of the sources, but still I can't get how to distinguish between the callee and the caller. Thank…
Pierre C
  • 1
  • 3
-1
votes
1 answer

Why the result are so strange

int main( ) { int x = 5; float y = 3.1f; printf("int x=%d ,float x=%f ,y=%f, y=%d\n", x, x, y, y); //X86 return 0; } I think the answer are 5 , 5.0 , 3.1 , 3. but the answer is enter image description here why?
lllle00
  • 11
  • 2
-1
votes
1 answer

STDCALL vs CDECL: `ret` vs `sub esp` have anything to do with the calling convention?

In Assembly Language, Seventh Edition for x86 Processors by Kip Irvine, on page 325, it says under 8.2.4 32-Bit Calling Conventions, The C Calling Convention ... The C calling convention solves the problem of cleaning up the runtime stack in a…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
-1
votes
1 answer

Simple encryption Assembly Program - Access violation writing to memory location

I had to implement a cdecl calling convention into this program which originally used a non standardized convention. As far as I can tell it looks right, but I get a unhandled exception error saying "Accress violation writing location 0x00000066,…
-2
votes
1 answer

vc++ stdcall function assign to cdecl function pointer worked, why?

//cdecl function pointer int(__cdecl* pfn)(int, int, int, int, int, int, int, int); //stdcall function int __stdcall HHH(int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) { cout << "HHH" << (i + i1 + i2 + i3 + i4 + i5 + i6 + i7)…
1 2 3 4 5 6
7