stdcall

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

Writing naked functions with custom prolog and epilog code in Visual Studio

只愿长相守 提交于 2019-12-04 10:22:48
I'm writing some plugin code in a dll that is called by a host over which I have no control. The host assumes that the plugins are exported as __stdcall functions. The host is told the name of the function and the details of the arguments that it expects and dynamically crufts up a call to it via LoadLibrary, GetProcAddress and manually pushing the arguments onto the stack. Usually plugin dlls expose a constant interface. My plugin exposes an interface that is configured at dll load time. To achieve this my plugin exposes a set of standard entry points that are defined at the time the dll is

Why does first parameter in x86 assembly starts from offset 8?

若如初见. 提交于 2019-12-01 20:49:33
问题 I'm trying to develop understanding of Assembly language. I understand that when function creates stack frame, it pushes current EBP , than copies stack pointer value to the EBP . First (and only) function parameter is accessed by EBP + 8 . But why 8? Next value after pushed EBP is logically offset 4. I read many webpages, but it seems I don't understand this part. 回答1: The "missing" DWORD is the return address. The call stack looks like: ebp : saved ebp ebp + 4 : return address ebp + 8 :

Why does first parameter in x86 assembly starts from offset 8?

不想你离开。 提交于 2019-12-01 18:45:14
I'm trying to develop understanding of Assembly language. I understand that when function creates stack frame, it pushes current EBP , than copies stack pointer value to the EBP . First (and only) function parameter is accessed by EBP + 8 . But why 8? Next value after pushed EBP is logically offset 4. I read many webpages, but it seems I don't understand this part. The "missing" DWORD is the return address. The call stack looks like: ebp : saved ebp ebp + 4 : return address ebp + 8 : pushed parameter And then if the function uses local variables, since stack space is (typically) reserved for

Is there any equivalent for stdcall in GCC?

試著忘記壹切 提交于 2019-11-30 18:59:22
I'm working on my own kernel using GCC, and when calling C functions from asm code, I have to do add esp,xx myself. After some searching I found that stdcall is a Microsoft invention and can't use it in GCC. Is there any handy way to do this work? Is there any equivalence of stdcall in linux? my kernel in a linux environment Wait, is this your own kernel, or the Linux kernel? Because if it's your own kernel, it's not Linux any more. If you're working on Linux, you'll want to stick with regular calling conventions and write your assembly to match. If you're working on your own kernel, you can

Is there STDCALL in Linux?

半腔热情 提交于 2019-11-28 19:29:43
I'm trying to port a Windows app to Linux. This appplication marks some functions with the __stdcall attribute. However, i was told by a friend that stdcall is used only on windows and has no meaning in linux (but DOES exist in Windows GCC). I tried to search Google about that, and got some results state that there IS stdacll in Linux. So... ?? Besides, for GCC I saw 2 implementations for that: __attribute__((__stdcall__)) and __attribute__((stdcall)) (without the underscores near stdcall). Which one is preferred (If applied to Linux at all)? Thanks! The simplest solution is to just define _

Creating an MSVC import library from a DLL that uses stdcall

风格不统一 提交于 2019-11-28 04:12:21
问题 I have a dll that exports extern "C" __declspec(dllexport) int __stdcall Foo( void ); A dump of the dll shows ****************************************************************************** Section: Exports File Offset: 00001400 (5120) Flags: 00000000 Time Stamp: 00000000 Major Version: 0000 Minor Version: 0000 Exports from simple.dll 3 exported name(s), 3 export addresse(s). Ordinal base is 1. Sorted by Name: RVA Ord. Hint Name -------- ---- ---- ---- 00002104 3 0000 std::nothrow 00001258 2

Create a C# DLL That Can Be Imported in a Delphi App Using stdcall - Possible?

纵饮孤独 提交于 2019-11-27 02:48:35
问题 I have a program that I need to create a DLL for, hopefully in C#. The program is written in Delphi and I have an interface file to code to. The interface uses the stdcall calling convention. Is it possible to create a C# DLL that conforms to the interface and can be used in the Delphi application? Is there some sample code that demonstrates how to code the C# DLL to a stdcall interface method? 回答1: This is not possible in pure C#, but this is an article that shows how to add an unmanaged

Is there STDCALL in Linux?

删除回忆录丶 提交于 2019-11-27 01:20:47
问题 I'm trying to port a Windows app to Linux. This appplication marks some functions with the __stdcall attribute. However, i was told by a friend that stdcall is used only on windows and has no meaning in linux (but DOES exist in Windows GCC). I tried to search Google about that, and got some results state that there IS stdacll in Linux. So... ?? Besides, for GCC I saw 2 implementations for that: __attribute__((__stdcall__)) and __attribute__((stdcall)) (without the underscores near stdcall).

What is __stdcall?

蹲街弑〆低调 提交于 2019-11-26 12:15:42
问题 I\'m learning about Win32 programming, and the WinMain prototype looks like: int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show ) I was confused as to what this WINAPI identifier was for and found: #define WINAPI __stdcall What does this do? I\'m confused by this having something at all after a return type. What is __stdcall for? What does it mean when there is something between the return type and function name? 回答1: __stdcall is the calling