フィルターのクリア

Linking third party library not found

3 ビュー (過去 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 Center および File ExchangeWrite 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