How to use so file in Matlab?
24 ビュー (過去 30 日間)
表示 古いコメント
1. Can I use so file in Windows matlab? If yes, How to use it? 2. Can I use so file in Linux matlab? If yes, How to use it?
I want to use .so file in matlab. I made so file from c++ in linux. Can I use that so file in matlab?
I want to use it in windows matlab, but if it impossible, I can use matlab in linux.
0 件のコメント
回答 (1 件)
Harish Ramachandran
2018 年 1 月 2 日
Hello Sungmin,
If I understand correctly, you have a .so file along with C++ code which needs to be run in MATLAB. If that is the case, you can use Mex files in order to call your C++ code (along with the shared .so library file as a dependency) from the MATLAB command line. This is independent of the OS. You need to setup a supported mex C++ compiler and write a gateway function in C++.
After completing the above steps, you can proceed to compile the C++ code with the .so file.
mex gateway.cpp source.cpp file.so
3 件のコメント
he zhang
2019 年 11 月 19 日
Hi,
i encountered a problem on apply .so file:
firstly , i use mex command to compile mex function:
mex -v MexTest3.cpp libDemo3.so
and the information shows mex completed successfully. but then
when i use MexTest3() to apply mex function, it shows:
libDemo3.so: cannot open shared object file: No such file or directory.
it seems like .so file is not included or not in included path, so i did a test:
i create a main.cpp to apply libDemo3.so and it works.:
g++ mian.cpp -L. -lDemo3 -o main
So, something seems to be wrong with my matlab Mex. Do you have any suggestions? Thanks.
参考
カテゴリ
Find more on C MEX 파일 응용 프로그램 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!