I have MKL 2017 with update 1 installed in Windows 10.
I'm using DORM22 from Lapack as an example.
void DORM22( const char* side, const char* trans, const MKL_INT* m, const MKL_INT* n, const MKL_INT* n1, const MKL_INT* n2, const double* q, const MKL_INT* ldq, double* c, const MKL_INT* ldc, double* work, const MKL_INT* lwork, MKL_INT* info );
void __stdcall DORM22( const char* side, int side_len, const char* trans, int trans_len, const MKL_INT* n1, const MKL_INT* n2, const double* q, const MKL_INT* ldq, double* c, const MKL_INT* ldc, double* work, const MKL_INT* lwork, MKL_INT* info );
13 variables each. But is it me or n and m are missing from the stdcall declaration? In mkl_intel_s.lib I find
So it should be 15 variables...
Same story with
The arguments side and trans are, in effect, single-character strings since only the first character of each is used. Therefore, if string lengths are passed as "hidden" arguments at the end, after all the other variables, they can be left out or, if present, ignored. The caller will push those lengths first on the stack, but the Lapack/MKL routine knows that only the first character is needed, so it does not obtain the lengths that have been placed on the stack.
On the other hand, when the string length is passed immediately after each string, as in Compaq/Digital Fortran, the caller puts those lengths on the stack, so the C declaration has to show a place-holder variable in the corresponding position.
Hi, yep, but then __stdcall DORM22 should have 15 variables, not 13.
My question was: where are matrix dimensions
in the stdcall declaration (windows\mkl\include\mkl_lapack_stdcall.h)?
Lapack is written in Fortran. As you can see at http://www.netlib.org/lapack/explore-html/d3/db9/group__complex_o_t_h_e_rcomputational_gae585aa301066e2bcfd1fad4a93e2e6df.html#gae585aa301066e2bcfd1fad4a93e2e6df , DORM22 has 13 arguments, two of which are single-character arguments. If someone wants to call Lapack from C, the C code has to obey the argument passing conventions of the Fortran compiler used to build Lapack. For this reason, the C headers of Lapack routines will have to be modified if a different Fortran compiler or a different Fortran calling convention is used!
The reason I'm asking is because looking at the list of exported symbols in mkl_rt.dll stdcall-decorated DORM22 appears as _DORM22@60
Ie there should be 15 (=60/4) arguments. Header file lists 13, both stdcall and non-stdcall version. They just missed m an n by mistake somehow in mkl_lapack_stdcall.h...
Hint Function Entry Point Name 2000 (0x07D0) 7418 (0x1CFA) _DORM22@60 14066 (0x36F2) 11734 (0x2DD6) _dorm22@60 14068 (0x36F4) 11735 (0x2DD7) _dorm22_@60
(Anyway, if you look at DGEMM, stdcall-declared header has two more arguments than the non-stdcall one. I'm using both, and its fine. So, string lengths should be in stdcall-headers, I guess, but its not the issue of this thread.)
That's definitely a bug in MKL header file. Thanks for reporting.
Did you try to fix DORM22 declaration manually and to check whether it work or not?
I'm not really using it, I just parsed the header files and number of arguments does not match number of arguments in the dll-file.
It's easy to fix, but no reason to copy the bug from one version to the next... You may also want to check (they are all declared with 2-3 args less than what dll would indicate):