04-11-2024 11:42 AM
I'm building a DLL with LabVIEW so that others can hopefully call it with their programming language of choice. When I define the prototype for the function I'm given the option of using "standard calling conventions" or "c calling conventions". Is one of these choices preferred?
Solved! Go to Solution.
04-11-2024 11:59 AM
@Gregory wrote:
I'm building a DLL with LabVIEW so that others can hopefully call it with their programming language of choice. When I define the prototype for the function I'm given the option of using "standard calling conventions" or "c calling conventions". Is one of these choices preferred?
First, this is only an option for 32-bit DLLs. 64-bit DLLs always should use fastcall calling convention for normal C function calls in user space. This is the default calling convention for 64-bit Windows C compilers.
For 32-bit DLLs, cdecl is the default calling convention for even Microsoft Visual Studio compilers, even though the entire Windows API uses almost exclusively stdcall.
Personally I only use stdcall if it is required for some reason. Technically the only reason would be if you need to pass a function pointer to an existing API that is using stdcall. There is really no other reason to choose for stdcall. Every 32-bit environment that allows calling DLLs in some way supports both cdecl and stdcall.
04-11-2024 12:19 PM
Thank you Rolf!