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

Declare LAPACK/BLAS in mkl_rt.dll in VBA Excel


Hi guys,

I have problems with these issues below and need your help to solve them. I used default mkl_rt.dll, I do not build any custom DLL currently.

1. Are there any documents that give the instruction on how to use ByVal or ByRef for each type of variable in LAPACK/BLAS function in mkl_rt.dll? (DGETRF/DGETR for example)

2. How can I define which functions are the STDCALL version?

3. The codes below worked on Excel 64 bit and Windows 64 bit, however, they cannot work on Excel 32 bit and Windows 64 bit. Could you help me with this issue? (I deleted "PtrSafe" in Excel 32 bit). Sometimes, The "Bad DLL calling convention (Error 49)"  appears, most of time the excel just crash. 

Private Declare PtrSafe Function dgetrf Lib "mkl_rt.dll" _
    (ByRef M As Integer, _
     ByRef N As Integer, _
     ByRef A As Double, _
     ByRef LDA As Integer, _
     ByRef IPIV As Integer, _
     ByRef INFO As Integer)

Private Declare PtrSafe Function dgetri Lib "mkl_rt.dll" _
    (ByRef N As Integer, _
    ByRef A As Double, _
    ByRef LDA As Integer, _
    ByRef IPIV As Integer, _
    ByRef WORK As Double, _
    ByRef LWORK As Integer, _
    ByRef INFO1 As Integer)


4. Should I continue research this issue or I have to build my custom DLL which includes all needed LAPACK/BLAS function to use in VBA?

Please let me know if you need more information.

Thank you for your understanding.

0 Kudos
2 Replies
  1. There is no such documentation or instructions as mkl is never validated/tested under this environment.
  2. Please refer to the mkl user’s guide to see more details about stdcall
  3. No comments
  4. I don’t think you need to build the custom dll in that case. It will not help you to resolve the problem.




Hi Gennady,

Thank you for your answer, I will try other libraries to find the best match.


0 Kudos