DPLOTLIB Calling Convention

In C lingo, all DPLOTLIB.DLL functions use the __stdcall calling convention. A __stdcall function's arguments are pushed onto the stack from right to left, and the called function pops these arguments from the stack before it returns. __stdcall is typically used for Win32 API functions. The standard calling convention for C programs is usually __cdecl. The primary difference between __cdecl and __stdcall is that with __cdecl functions it is the caller rather than the called function that removes arguments from the stack. It is important when building your application that you specify the correct calling convention for DPLOTLIB functions. Failure to do so will lead to, at best, corrupted data after returning from a DPLOTLIB function and at worst crash your system.

The default calling convention for Visual Basic applications is __stdcall. For FORTRAN applications the default is vendor-dependent; consult your FORTRAN compiler's documentation. The example project files and/or batch files will use the correct calling convention. If you are using a language or compiler not included in the DPLOTLIB distribution you'll need to ensure that the proper convention is used.

For compilers that either will not support __stdcall or for situations when it is not convenient to use __stdcall, this distribution includes a __cdecl version of the library: DPLOTLIB_CC.DLL. It may be necessary for you to use this DLL if, for example, your program calls __cdecl functions in another library or object module and it is not possible with your compiler to use both __cdecl and __stdcall. This might very well happen with, for example, the g77 FORTRAN compiler, since the calling convention used for all object modules is specified with a single commandline switch rather than with interface definitions for specific functions.

 

 
Previous Home Next DPlot Home