How to use the BLAS library provided by MATLAB?

I noticed that MATLAB provides BLAS and LAPACK headers among others:

$ ls ${MATLAB_DIR}/extern/include/ blas.h engine.h lapack.h mat.h mclmcr.h mex.h mwutil.h blascompat32.h fintrf.h libmatlbm.mlib matrix.h mclmcrrt.h mwdebug.h tmwtypes.h emlrt.h io64.h libmatlbmx.mlib mclcppclass.h mcr.h mwservices.h 

I would like to use them for my compiled code, so I tried to compile the following:

ex_blas.c

 #include <blas.h> int main() { return 0; } 

with the following command:

 $ mex ex_blas.c 

But this returns an error:

 In file included from ex_blas.c:1: /Applications/MATLAB_R2009b.app/extern/include/blas.h:51: error: syntax error before '*' token /Applications/MATLAB_R2009b.app/extern/include/blas.h:62: error: syntax error before '*' token /Applications/MATLAB_R2009b.app/extern/include/blas.h:77: error: syntax error before '*' token /Applications/MATLAB_R2009b.app/extern/include/blas.h:92: error: syntax error before '*' token /Applications/MATLAB_R2009b.app/extern/include/blas.h:103: error: syntax error before 'ptrdiff_t' /Applications/MATLAB_R2009b.app/extern/include/blas.h:122: error: syntax error before 'ptrdiff_t' 

Is blas.h provided by MATLAB for use by a third-party application outside MATLAB? If so, what causes the error above?

+2
blas matlab
Nov 14 '09 at 23:35
source share
1 answer

I'm not sure that it will completely fix your problems, but you can also include stddef.h , as this is defined by the ptrdiff_t .

+4
Nov 14 '09 at 23:59
source share



All Articles