Linking third party library not found

조회 수: 2 (최근 30일)
Jeremy Hu
Jeremy Hu 2020년 7월 6일
댓글: Jeremy Hu 2020년 7월 6일
Greetings, I have been trying for a few days to compile a third party lib file to the matlab mex files on windows 10, matlab v2020a
The third party library is sparse solver pardiso: https://pardiso-project.org/, this library comes with its own .lib files for the underlying pardiso solver routines, as well as its own mex cpp bindings. I am finding that compilation goes down successfully, but calling any of the resulting mexw64 files yields
Invalid MEX-file 'pardiso_intel_compiler_Windows\pardiso-matlab-mex\pardisoinit.mexw64': The specified module could not be found.
I've isolated the source to a subroutine call in one of the mex cpp files:
pardisoinit_(pt,&mtype,&solver,iparm,dparm,&error); // pardisoinit_ not being linked correctly?
This function should supposedly be in the static library (-lpardiso) that I link against:
mex(['-L' 'C:\Program Files\MATLAB\R2020a\extern\lib\win64\microsoft'],...
['-L' '.'], '-lpardiso',...
['-L' 'C:\MinGW\bin'], '-lmwlapack', '-lmwblas',...
['-L' 'C:\Users\jeremy\Desktop\pthreads-w32-2-9-1-release\Pre-built.2\lib\x64'], '-lifcoremt',...
['-L' 'C:\Program Files (x86)\IntelSWTools\parallel_studio_xe_2020.1.086\compilers_and_libraries_2020\windows\compiler\lib\intel64_win'],...
'-lpthreadVC2',...
'-lm', '-output', name,...
'common.cpp', 'matlabmatrix.cpp', 'sparsematrix.cpp', 'pardisoinfo_test.cpp',...
[name '.cpp']);
and is declared in the corresponding header file as
// External Fortran routines defined in the PARDISO dll.
extern "C" int pardisoinit_(void *, int *, int *, int *, double *, int *);
extern "C" int pardiso_(void *, int *, int *, int *, int *, int *,
void *, int *, int *, int *, int *, int *,
int *, void *, void *, int *, double *);
I can't seem to figure out where to go from here, any help would be much appreciated!
Thanks, Jeremy
  댓글 수: 2
James Tursa
James Tursa 2020년 7월 6일
Can you use loadlibrary( ) to see if MATLAB sees those functions in the library? Can you try UPPERCASE for the prototype names? Maybe the Fortran compiler converted the names to uppercase.
Jeremy Hu
Jeremy Hu 2020년 7월 6일
Hi James,
So the library I'm linking against in the script above is pardiso.lib, in the downloaded package there was also
pardiso.dll; I can only assume that they were compiled from the same source code.
Since loadlibrary only accepts dlls, I called loadlibrary on pardiso.dll, and it does see all the functions:
Functions in library pardiso_rename:
pardiso pardiso_chkmatrix pardiso_chkvec pardiso_printstats pardisoinit
The signatures are different (no underscore eg pardisoinit_) because I used the example C headers that they provided from the documentation.
I also tried (PARDISOINIT_ , PARDISO_), (PARDISO, PARDISOINIT), and (pardisoinit, pardiso) within the cpp file, and editted the corresponding header file in case it was a different name in the lib file, but unfortunately it's the same error.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by