How to define Mex function dependency paths

I have a 'C' mex function (which is of course a dll with .mexa64 extension instead of .dll). It depends on other libraries, so during linking my makefile uses the link time flags -Wl, -rpath,$(INSTALLPATH) to allow the dependencies to be resolved at runtime. Of course I also link with -L$(INSTALLPATH) and -lmylib1 -lmylib2 etc... Both my mex function and its libraries reside in the same folder, and I add that folder to the Matlab 'path' variable in startup.m When I attempt to run my mex program however, Matlab returns with: Invalid MEX-file '$(INSTALLPATH)/mymexfunc.mexa64': libmylib.so.1: cannot open share object file: No such file or directory. Is there something else I need to do so the dependencies can be resolved?

답변 (1개)

Raggie A Pauly
Raggie A Pauly 2017년 6월 23일
편집: Walter Roberson 2020년 4월 9일

0 개 추천

I fixed the whole _SECURE_SCL flag issue. The end result is that for your case, you shouldn't have to make any manual changes but one problem I have is that whenever I run one of the matlab files it works fine the first time, but crashes the second time. Thanks for taking the time to help me out.

카테고리

도움말 센터 및 File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

질문:

2017년 6월 21일

편집:

2020년 4월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by