フィルターのクリア

Exception on debug C shared library based application when using visual studio 2017

7 ビュー (過去 30 日間)
Poorren
Poorren 2022 年 8 月 1 日
回答済み: stomach 2023 年 4 月 21 日
Hello guys,
Now, I try and study to use Matlab library compiler to convert matlab script to library function, and call it in C application.
Follow the tutorial in help, I could manage to compile and run the matrix example with mbuild tool (matlabroot\extern\examples\compilersdk\c_cpp\matrix).
Furthermore, I want to move another step to debug the program in visual studio. I configure the visual c++ as below post.
The visual studio could compile and run the executable correctly. But, the question now is I couldn't debug it correctly.
When I use single step debug, mclInitializeApplication(NULL,0) function will run very slowly, and debug output lots of exception message.
Exception thrown at 0x00007FFE9DCA9319 in matrix_exp_svr.exe: Microsoft C++ exception: mwboost::exception_detail::clone_impl<fl::filesystem::PathNotFound> at memory location 0x00000041850F9CA0.
If I ignored those exception, and try to step over libmatrixInitialize(),
The program finally stop with the following exception.
Exception thrown at 0x000001B51C3303B4 in matrix_exp_svr.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
So, does anybody have met similar problem? Please share your insight, thanks a lot!
Jeff
  5 件のコメント
stomach
stomach 2023 年 4 月 21 日
Hi, Poorren, did you solve this problem? I encountered the same problem that MATLAB shared library can not be debugged in visual studio.
stomach
stomach 2023 年 4 月 21 日
I have found some information for this problem which says MATLAB shared library can not be built in debug mode.
Access Violation When Calling Library Function
The library file must be built in release mode, using a C++ compiler that MATLAB supports. If you build the library in debug mode, it might be incompatible with MATLAB, resulting in a termination of the program.

サインインしてコメントする。

回答 (1 件)

stomach
stomach 2023 年 4 月 21 日
More evidence has shown that it is impossible to debug the MATLAB shared library:
https://www.mathworks.com/matlabcentral/answers/93287-is-there-a-way-to-debug-a-matlab-compiler-4-0-r14-generated-executable

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by