필터 지우기
필터 지우기

I try to use a c-shared library from the matlab (2017a) compiler in VC++ 2017. the call to the initialize function of the dll crashes.

조회 수: 2 (최근 30일)
I created a simple dll called TestMatlabDLL with matlab compiler 2017a. I created a visual studio 2017 console application and tried to load the dll. I included TestMatlabDLL.h/.c/.lib/.dll to the VS project according to many different documentations. The compilation/linking process shows no errors or warning. But whatever I do, the call to TestMatlabDLLInitialize() crashes. I would also appreciate if somebody could send me or point me to a sample Visual Studio project that uses a Matlab dll (preferrably everything version 2017).

답변 (2개)

Markus Schiefele
Markus Schiefele 2017년 5월 30일
I can now answer at least a part of my question myself. In my first version I did not have a call to mclRunMain. As a consequence of this, TestMaylabDLL.dll was not loaded. Adding mclRunMain to my code however did not improve my situation significantly. Now I am getting a linker error (LNK2005) for a double defined symbol called times2 (the function I want to export). Looking at TestMatlabDLL.dll (in DependencyWalker) and TestMatlabDLL.cpp I am afraid I must agree with the linker: times2 is defined in both! Does somebody have a similar experience? Can this be a Matlab bug? Did anybody get a Matlab compiler C/C++ shared library to run under Visual Studio 2017? Any kind of help is greatly appreciated.

Riccardo Fossati
Riccardo Fossati 2017년 6월 10일
편집: Riccardo Fossati 2017년 6월 10일
Hi Markus, I have encountered a problem similar to yours while trying to run the code I wrote in VS2013 that links to a function in Matlab R2016a. Have you found some kind of solution? Thanks a lot
Riccardo Fossati

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by