Matlab C++ Shared dll library initialization crash

조회 수: 2 (최근 30일)
Dominik Brugger
Dominik Brugger 2018년 6월 5일
답변: Anurag Pratap Singh 2020년 6월 24일
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

답변 (1개)

Anurag Pratap Singh
Anurag Pratap Singh 2020년 6월 24일
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.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by