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 Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by