Conventions for Calling DLL Functions

The following calling conventions are supported when calling DLL functions:
  • __stdcall
  • __cdecl

The __stdcall calling convention is used by default when calling DLL functions. This calling convention is used by all Windows API DLL functions.

You can change the calling convention for a DLL function by using the CallingConvention property of the DllFunctionOptions attribute.

Example

The following code example declares a DLL function with the __decl calling convention:
<Dll("msvcrt.dll")> Public Interface IMsVisualCRuntime
 <DllFunctionOptions(CallingConvention:=CallingConvention.Cdecl)> Function cos(ByVal input As Double) As Double
End Interface