Matlab C++ Shared dll library initialization crash
2 views (last 30 days)
Show older comments
I created a shared library for interfacing matlab functionality from a C++ project. My build environment is as follows:
- Matlab R2018a
- Visual Studio 2017
- Windows 10
When initializing the library the application crashes.
I can confirm that using the "-nojvm" option as suggested here: https://de.mathworks.com/matlabcentral/answers/286624-matlab-c-shared-dll-library-initialization-problem avoids the crash.
Yet this is not a viable solution in my case as I have to integrate a library that uses matlab figure handles. Using "-nojvm" therefore leads to a runtime error:
Error using figure
This functionality is no longer supported under the -nojvm startup option. For more information, see "Changes to -nojvm Startup Option" in the MATLAB Release Notes. To view the release note in your system browser, run web('http://www.mathworks.com/help/matlab/release-notes.html#btsurqv-6', '-browser').
I have attached a small example project that reproduces the crash and interfaces a simple function:
function createPlot()
fh = figure;
plot(1:10, 1:10);
saveas(fh, 'test', 'png');
end
0 Comments
Answers (1)
Anurag Pratap Singh
on 24 Jun 2020
Hi Dominik
I understand that you are trying to create a shared library for interfacing matlab functionality from a C++ project.
I would suggest you to use a different version of visual studio or matlab for this as there might be some mismactch of the versions.
0 Comments
See Also
Categories
Find more on Startup and Shutdown 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!