How to link during Matlab's MEX compilation

后端 未结 3 1959
春和景丽
春和景丽 2020-12-10 16:44

I\'ve written a program of the following form:

#include \"stuff_I_need.h\"

int main(){

construct_array(); // uses OpenMP pragma\'s
print_array();

return(0         


        
3条回答
  •  天涯浪人
    2020-12-10 17:35

    Kwatford put me on the right track with the second question. I was able to get the mex command to work by rebuilding the sundials solver with shared libraries. Specifically, I built with:

    % make distclean
    % ./configure --prefix=/home/matteson/sundials --enable-shared
    % make
    % make install
    

    Also, thanks to kwatford for the fix to the original by calling:

    mex -v CC="gcc44" CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" -I/home/matteson/sundials/include/ -L/home/matteson/sundials/lib -lsundials_cvode -lsundials_nvecserial mex_cvode.c
    

    since mex knows how to handle the -L and -I.

提交回复
热议问题