フィルターのクリア

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 Center および File ExchangeC Shared Library Integration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by