Hello,

this is an issue already discussed but I have not been able to find a solution. I'm using Intel MKL 10.2 and MATLAB R2011b. My C function, which has many MKL BLAS and MKL Lapack calls, runs well when called from a C program.

When called from a mex file, MATLAB crashs. If I comment all the calls to mkl, it works (but output array are all zeros, as I don't perform calculations), so it is the call to Intel mkl that crashs matlab. I downlaoded yesterday the lastest version of Intel MKL but it did'nt solve the problem.

From what I can read here https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-using-intel-mkl-in-matlab-executable-mex-files

there are 2 possible causes:

1) The mex file is linked to the static threading library

or

2) The mex file is linked to the Intel MKL 10.3.x (or later) dynamic libraries. When the mex file is invoked, MATLAB crashes.. This occurs when the Intel MKL dynamic libraries used by the mex file are conflicting with those used by MATLAB. To resolve the problem, use static linking or link to a custom dynamic library and link to the dynamic threading library

I don't use the threading library, as I plan to use the matlabpool function later so I'm guessing the problem is 2). However, I use static linking:

mex mx_func_test.c -I/.../mkl/include -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_lapack -lrt -lm (I removed -lmkl_lapack when used MKL 11 because I doesn't exist anymore).

In MATLAB version -blas and -lapack return : Intel MKL 10.3.2.

So my questions are:

- is it possible to link my MKL call (in my C code) to the Intel MKL lib included in MATLAB (-> 10.3.2) ?

- or, is it possible to change the linking in MATLAB so it uses 10.2 or 11 ? It seems possible from what I read here but the procedure is not clear :http://www.mathworks.com/matlabcentral/newsreader/view_thread/305856

I hope I won't have to change my code to use ATLAS instead :(