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.
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.
3 views (last 30 days)
Show older comments
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).
0 Comments
Answers (2)
Riccardo Fossati
on 10 Jun 2017
Edited: Riccardo Fossati
on 10 Jun 2017
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
0 Comments
See Also
Categories
Find more on C Shared Library Integration 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!