2
votes

I have noticed that MATLAB provides the 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 the blas.h provided by MATLAB usable by a 3rd party application outside of MATLAB? If yes, what is causing the error above?

1

1 Answers

4
votes

I'm not sure if it will completely resolve your problems, but you may also have to include stddef.h since that is where the ptrdiff_t type is defined.