cdecl

What does “cdecl” stand for?

匆匆过客 提交于 2021-02-05 20:17:39
问题 Yes, I know that "cdecl" is the name of a prominent calling convention, so please don't explain calling conventions to me. What I'm asking is what the abbreviation (?) "cdecl" actually stands for. I think it's a poor naming choice, because at first sight it reminds one of "C declarator" (a rather unique syntactic aspect of C). In fact, there is a program called cdecl whose sole purpose is to decipher C declarators. But the C declarator syntax has absolutely nothing to do with calling

AccessViolationException when PInvoking C++ DLL (cdecl calling convention problem?) [closed]

…衆ロ難τιáo~ 提交于 2020-05-14 18:17:12
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I've spent all day researching this, and I'm none the wiser: I have a C# DLL which PInvokes a method in a C++ DLL. I have had no problems doing this when compiling in Debug mode, but when compiling in Release mode I get an AccessViolationException. Googling this problem tells me

AccessViolationException when PInvoking C++ DLL (cdecl calling convention problem?) [closed]

泄露秘密 提交于 2020-05-14 18:15:24
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I've spent all day researching this, and I'm none the wiser: I have a C# DLL which PInvokes a method in a C++ DLL. I have had no problems doing this when compiling in Debug mode, but when compiling in Release mode I get an AccessViolationException. Googling this problem tells me

Pass an argument from C to assembly?

☆樱花仙子☆ 提交于 2019-12-29 07:15:31
问题 How can I pass an argument from a C main function to an assembly function? I know that my custom function has to look something like: void function(char *somedata) __attribute__((cdecl)); Now how would I use somedata in an assembly file. My operation system is Linux Ubuntu and my processor is x86. 回答1: I'm a bit of a noob at this but hopefully this example will get you on your way. I've tested it and it works, the only issue you might have is software not being available. I'm using nasm for

Calling a function that can be either cdecl or stdcall

我的梦境 提交于 2019-12-23 10:51:22
问题 I need to write code that calls an external function that can be either stdcall call or cdecl in a 32bit windows application. My code, the caller, can't know in advance which of these its going to be. Right now, if I try to call a cdecl function from a call site that was defined as stdcall, I get a checkEsp exception dialog, and I'm guessing that's there for a good reason. Is there any way to do it? 回答1: It can be done following way: mov esi, esp push arg3 push arg2 push arg1 call

How do I compile boost using __cdecl calling convention?

最后都变了- 提交于 2019-12-12 01:54:59
问题 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: ...\boost\boost\program_options\detail\parsers.hpp Line: 79 Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer

Dumpbin shows strange method name (generating exporting function in MS Visual C++)

烂漫一生 提交于 2019-12-11 10:35:58
问题 I have created new Win32 project in my VS and have selected Dynamic Library ( *.dll ) for this aim. I have defined some exporting function in the main file: __declspec(dllexport) int TestCall(void) { int value = 4 / 2; std::cout << typeid(value).name() << std::endl; return value; } __declspec(dllexport) void SwapMe(int *first, int *second) { int tmp = *first; *first = *second; *second = tmp; } When I've looked at the dumpin /exports, I've got: ordinal hint RVA name 1 0 00001010 ?SwapMe@

C++ and FULLY dynamic functions

久未见 提交于 2019-12-10 13:34:29
问题 I have a problem with detours. Detours, as you all know, can only move among 5 bytes of space (i.e a 'jmp' call and a 4 byte address). Because of this it is impossible to have the 'hook' function in a class (a method), you cannot supply the 'this' pointer because there is simply not enough space (here's the problem more thoroughly explained). So I've been brainstorming all day for a solution, and now I want your thoughts on the subject so I don't begin a 3-5 day project without knowing if it

In C++, do variadic functions (those with … at the end of the parameter list) necessarily follow the __cdecl calling convention?

寵の児 提交于 2019-12-07 00:22:58
问题 I know that __stdcall functions can't have ellipses, but I want to be sure there are no platforms that support the stdarg.h functions for calling conventions other than __cdecl or __stdcall. 回答1: The calling convention has to be one where the caller clears the arguments from the stack (because the callee doesn't know what will be passed). That doesn't necessarily correspond to what Microsoft calls "__cdecl" though. Just for example, on a SPARC, it'll normally pass the arguments in registers,

In C++, do variadic functions (those with … at the end of the parameter list) necessarily follow the __cdecl calling convention?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 05:42:43
I know that __stdcall functions can't have ellipses, but I want to be sure there are no platforms that support the stdarg.h functions for calling conventions other than __cdecl or __stdcall. The calling convention has to be one where the caller clears the arguments from the stack (because the callee doesn't know what will be passed). That doesn't necessarily correspond to what Microsoft calls "__cdecl" though. Just for example, on a SPARC, it'll normally pass the arguments in registers, because that's how the SPARC is designed to work -- its registers basically act as a call stack that gets