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 function.
I have a function in myModule.h
SIZE_T MyFunc(PVOID IN param1, PVOID IN param2);
However adding __stdcall
to the function signature in the following way:
SIZE_T __stdcall MyFunc(PVOID IN param1, PVOID IN param2);
yields a linking error:
LNK2019 unresolved external symbol _MyFunc@8
The definition of the function is in myModule.asm
, and after removing the __stdcall
clause, the code compiles and links correctly.
Does anyone know how to do that in the right way?
I also tried to change the whole .asm
file to use stdcall convention, by changing:
properties->configurations properties->microsoft macro assembler->advanced->calling convention
But still the functions are being called as cdecl, when the caller cleans the stack.
Thank you!