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
0 answers

Why does my C++ DLL not work with my Delphi application?

According to Delphi to C++ types mapping, Delphi equivalent of wchar_t* is PWideChar. DLL Header File: #include #include #include using namespace std; #ifdef __cplusplus extern "C" { #endif wchar_t* DLL_EXPORT…
0
votes
1 answer

Call a StdCall Subroutine in Fortran

I have two subroutines in a DLL. To call them in C#, they are changed to STDCALL like this: SUBROUTINE MoveToZero(X, N) !DEC$ ATTRIBUTES DLLEXPORT::MoveToZero !DEC$ ATTRIBUTES STDCALL,ALIAS:'RemoveBias'::MoveToZero USE MKL_DFTI …
Chen
  • 33
  • 1
  • 5
0
votes
2 answers

mingw - cdecl required to run functions correctly

The code below is running correctly with any online gcc compiler I found (gcc 9.2.0), it also run correctly with CYGWIN gcc compiler, but unfortunately it doesn't work well with MINGW gcc compiler - looks like it passes invalid parameter as "this"…
0
votes
0 answers

Calling C++/CLR function from C# - passing parameters not working

I'm trying to call a function in a C++/CLR dll from a C# dll. -> this is working pretty well. The issue I'm facing is the parameters which should be passed from C# to the function in C++/CLR are not arriving correctly in C++. In the end I need to…
0
votes
1 answer

Unexpected calling convention for PInvoke

I have a library in dll and its header file, I don't have source for it. I need to use pinvoke to call this unmanaged code from C#, but have problem in setting calling convention. The header file look like: #ifdef EVOLIB_EXPORTS #define EVOLIB_API…
0
votes
4 answers

What's the use of __cdecl in function arguments in C

I am learning C language and while learning I found a line of code which is totally new and strange for me void PullDown(char **, int, void (__cdecl **)(void)); I know about 1st and 2nd parameter only . I want to know about 3rd parameter. what's…
Aux
  • 85
  • 2
  • 3
  • 10
0
votes
1 answer

Check whether function called through function-pointer has a return statement

We have a plugin system that calls functions in dlls (user-generated plugins) by dlopening/LoadLibrarying the dll/so/dylib and then dlsyming/GetProcAddressing the function, and then storing that result in a function pointer. Unfortunately, due to…
Philipp
  • 957
  • 1
  • 6
  • 20
0
votes
1 answer

Need help understanding stack frame layout

While implementing a stack walker for a debugger I am working on I reached the point to extract the arguments to a function call and display them. To make it simple I started with the cdecl convention in pure 32-bit (both debugger and debuggee), and…
Warepire
  • 21
  • 2
0
votes
1 answer

cdecl clarification required: what is an "array 5?"

Go here: http://cdecl.org/ Input: char (*arr)[5] Output: declare arr as pointer to array 5 of char What is an "array 5"? Does this simply mean an array with 5 elements?
Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
0
votes
0 answers

Exception when passing parameter in cdecl and pascal

void cdecl fun1(int,int); void pascal fun2(int,int); int main(){ int a=5,b=5; fun1(a,++a); fun2(b,++b); return 0; } void cdecl fun1(int p,int q){ printf("cdecl: %d %d \n",p,q); } void pascal fun2(int p,int q){ printf("pascal: %d…
sameer pradhan
  • 324
  • 1
  • 4
  • 14
0
votes
0 answers

Recersive proc in x8086 Assembly

;============================================================================================== ; recursive procedure: ; supersum(int x) ; returns 1*2 + 2*3 + 3*4 + ... + i*(i+1) supersum PROC push ebp ; start of every procedure …
0
votes
0 answers

X86 assembly cdecl confusion

Morning, I've implemented a cdecl call method into the following 'encryption' routine. However whilst my method works, it's not following the recommended (uni and other sources) exactly. Advise appreciated (Some comments may be 'wrong' cdecl…
0
votes
0 answers

cdecl and std call - how to make my code conventional

__asm { // push eax // push ecx // movsx ecx, temp_char // lea eax, EKey // call encryptX // encrypt the…
0
votes
1 answer

CDecl cleanup code in explicitly linked DLL

I have a function in an unmanaged Win32 DLL that takes a variable number of arguments and therefore needs to be __cdecl rather than __stdcall or any other calling convention. At the moment I'm linking explicitly to the DLL (which is to say, I'm…
Govind Parmar
  • 20,656
  • 7
  • 53
  • 85
0
votes
0 answers

Implementing a C++ calling convention in ASM x86

I've written a simple program that obfuscates a string using ASM x86. User must input their desired string, and then choose a key (Ekey) for the string to be obfuscated. (I know you can emulate left and right bit rotations with shift operators or…