LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When Building a DLL with LabVIEW is "standard" or "c" calling convention more common?

Solved!
Go to solution

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?

0 Kudos
Message 1 of 3
(200 Views)
Solution
Accepted by topic author Gregory

@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.

Rolf Kalbermatter
My Blog
Message 2 of 3
(194 Views)
0 Kudos
Message 3 of 3
(175 Views)