Questions tagged [stdcall]

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

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

See Wikipedia on:

150 questions
1
vote
1 answer

Closures with the STDCALL ABI on x86 Windows cause Stack Overflow exceptions with LibFFI 3.2.1

I am using the libffi library (version 3.2.1) to enable API interfacing from a scripting language, by allowing the scripter to create prototypes for invoking API functions or defining API-compatible callback functions. On x64, only one calling…
Bas Groothedde
  • 402
  • 4
  • 8
1
vote
1 answer

Do I need to prefix this function with __stdcall?

When learning about debugging OpenGL I implemented a function callback which would receive any debug error messages from the OpenGL API whenever something went wrong. In the tutorial it said that the function signature was: typedef void APIENTRY…
Zebrafish
  • 11,682
  • 3
  • 43
  • 119
1
vote
1 answer

Very strange segfault calling WinUsb_GetOverlappedResult

I have this code: void GetResult(WINUSB_INTERFACE_HANDLE InterfaceHandle, LPOVERLAPPED lpOverlapped) { DWORD numBytes = 0; WinUsb_GetOverlappedResult( InterfaceHandle, lpOverlapped, &numBytes, …
Timmmm
  • 88,195
  • 71
  • 364
  • 509
1
vote
0 answers

Call MASM function in StdCall convention

I write a program in C, in visual studio 2015, and I have a masm module in it. I want to define some of the functions to be called as stdcall instead of the default cdecl. is there a way do that? My goal is to skip the stack cleanup in the caller…
macro_controller
  • 1,469
  • 1
  • 14
  • 32
1
vote
1 answer

Fastest (CPU-wise) way to do functions in intel x64 assembly?

I've been reading about assembly functions and I'm confused as to whether to use the enter and exit or just the call/return instructions for fast execution. Is one way fast and the other smaller? For example what is the fastest (stdcall) way to do…
Ryan Brown
  • 1,017
  • 1
  • 13
  • 34
1
vote
1 answer

stdcall calling convention and using pinvoke in C#

I created a DLL file which includes two empty functions below. extern "C" __declspec(dllexport) void __stdcall myFunc1() { // just empty function } extern "C" __declspec(dllexport) void __cdecl myFunc2() { // just empty function } In C#, I…
Jenix
  • 2,996
  • 2
  • 29
  • 58
1
vote
2 answers

Using GetProcAddress when the name might be decorated

What is the correct way to use GetProcAddress() on a 32 bit DLL? On win32, there are three calling conventions, cdecl, stdcall and fastcall. If the function in the DLL is foo they will decorate the name in the following ways _foo, _foo@N and @foo@N.…
1
vote
0 answers

std call of win32 dll function differs in Pascal and c++

I have C dll with this function: int CALLINGCONV SMIMESignML( const char* pin, unsigned long slot, const char* szOutputFilePath, const char* szFrom, const char* szTo, const char* szSubject, const char* szOtherHeaders, const char*…
1
vote
1 answer

Mix cdecl and stdcall calling conventions

I have an already built static library on Windows VS2012 (.lib), compiled with the stdcall convention. When I say "already built", I mean unfortunatedly I cannot rebuild it with the calling convention of my choice. Is it possible to call a function…
GaTTaCa
  • 459
  • 6
  • 18
1
vote
1 answer

Error converting void(__cdecl MyClass::*)() to void *

I am trying to link to an external library in my QT application. The external library has a header file with the following relevant code I'm trying to call: extern VGRABDEVICE_API bool V_AssignFrameSizeCallback(IGrabChannel* pChannel, void*…
user2406671
  • 37
  • 1
  • 7
1
vote
4 answers

C - properly importing stdcall functions from unmanaged DLL

I am trying to import a function from an unmanaged DLL into a C project by creating a .def file specifying the function I need to use. I am practicing on the WinAPI function MessageBoxA from user32.dll. It is an stdcall function, like the other…
user3079266
1
vote
1 answer

GCC ignores calling convention attribute

does anyone know why this doesnt work? void test() [[stdcall]] { std::cout << "Hello World" << std::endl; } when I try to compile with C++11 dialect it says: "warning: 'stdcall' attribute directive ignored [-Wattributes]" Why is that? I…
user2276094
  • 399
  • 1
  • 4
  • 11
1
vote
0 answers

Linker ignores options from g++

I'm trying to create object file without @-suffix with g++: g++ -Wl,--add-stdcall-alias -c test.cpp or g++ -Wl,--kill-at -c test.cpp But none of options works. Using: MinGW32 with g++ v4.4, ld v2.19.1 Thanks!
Sas
  • 523
  • 3
  • 21
1
vote
1 answer

Is it necessary to care about calling convention of a function that is not exported from dll

I am currently working on a project that involves creating some DLL libraries with C that will be shipped to customers. The DLL exports some functions and all exported functions use the __stdcall calling convention. The library also contains some…
MxNx
  • 1,342
  • 17
  • 28
1
vote
1 answer

Howto create C-Header for Delphi/Free Pascal/Lazarus DLL - data types

For my application I need to create a DLL from Delphi (to be more precise Delphi compatible code written within Lazarus IDE compiled by free pascal under linux) using stdcall. When using that DLL (for example in Matlab or so) one needs of course the…
Bastian Ebeling
  • 1,138
  • 11
  • 38