Using the cdecl and stdcall Interfaces

Intel MKL provides the following interfaces in its IA-32 architecture implementation:

  • stdcall
    Default Compaq Visual Fortran* (CVF) interface. Use it with the Intel® Fortran Compiler.
  • cdecl
    Default interface of the Microsoft Visual C/C++* application.

To use each of these interfaces, link with the appropriate library, as specified in the following table:

Interface

Library for Static Linking

Library for Dynamic Linking

cdecl

mkl_intel_c.lib

mkl_intel_c_dll.lib

stdcall

mkl_intel_s.lib

mkl_intel_s_dll.lib

To link with the cdecl or stdcall interface library, use appropriate calling syntax in C applications and appropriate compiler options for Fortran applications.

If you are using a C compiler, to link with the cdecl or stdcall interface library, call Intel MKL routines in your code as explained in the table below:

Interface Library

Calling Intel MKL Routines

mkl_intel_s [_dll].lib

Call a routine with the following statement:

extern __stdcall name( <prototype variable1>, <prototype variable2>, .. );

where stdcall is actually the CVF compiler default compilation, which differs from the regular stdcall compilation in the way how strings are passed to the routine. Because the default CVF format is not identical with stdcall, you must specially handle strings in the calling sequence. See how to do it in sections on interfaces in the CVF documentation.

mkl_intel_c[_dll].lib

Use the following declaration:

<type> name( <prototype variable1>, <prototype  variable2>, .. ); 

If you are using a Fortran compiler, to link with the cdecl or stdcall interface library, provide compiler options as explained in the table below:

Interface Library

Compiler Options

Comment

CVF compiler

mkl_intel_s[_dll].lib

Default

mkl_intel_c[_dll].lib

/iface=(cref, nomixed_str_len_arg)

Intel® Fortran compiler

mkl_intel_c[_dll].lib

Default

mkl_intel_s[_dll].lib

/Gm
or
/iface:cvf

/Gm and /iface:cvf options enable compatibility of the CVF and Powerstation calling conventions

Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.