Linking third party library not found
3 views (last 30 days)
Show older comments
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 Comments
James Tursa
on 6 Jul 2020
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.
Answers (0)
See Also
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!