Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7108 Discussions

What is the calling convetion for i_malloc and friends on 32bit Windows

djunglas
New Contributor I
644 Views

Hello,

I am trying to redefine memory allocation functions for MKL by using function pointer i_malloc and friends as described in https://software.intel.com/en-us/node/528395. On 32bit Windows however I am facing a problem: I could not figure out what is the calling convention for those functions? Is it __cdecl, __stdcall, __fastcall? The i_malloc.h header just says

typedef void * (* i_malloc_t)(size_t size);

But depending on whether I set -Gz for compilation or not this may change the calling convention on this function. Am I missing something here or should the header explicitly specify the calling convention?

Anyway, what actually is the calling convention that MKL assumes for these functions?

Thanks,

Daniel

0 Kudos
1 Solution
Ying_H_Intel
Employee
644 Views

Hi Daniel,

Right, everything in MKL is called using __cdecl convention.

On Win32 there is support for ancient Compaq Visual Fortran (CVF) interface (by linking user app in CVF with mkl_intel_s.lib) which is __stdcall.

 

Regards

Ying

 

View solution in original post

0 Kudos
2 Replies
djunglas
New Contributor I
644 Views

Seems like there is some evidence that the expected calling convention is __cdecl: Compiling with -Gz (which implies __stdcall) my application crashes in mkl_serv_allocate(). Compiling without -Gz (which implies __cdecl, I think) everything works fine.

Can someone confirm that the functions should be __cdecl?

0 Kudos
Ying_H_Intel
Employee
645 Views

Hi Daniel,

Right, everything in MKL is called using __cdecl convention.

On Win32 there is support for ancient Compaq Visual Fortran (CVF) interface (by linking user app in CVF with mkl_intel_s.lib) which is __stdcall.

 

Regards

Ying

 

0 Kudos
Reply