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 次查看(过去 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).
0 个评论
回答(2 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 C Shared Library Integration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!