Problem of loading plugin in Matlab scripting

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Xiangjie Meng
Posts: 15
Joined: Wed Sep 05, 2012 8:09 pm

Problem of loading plugin in Matlab scripting

Post by Xiangjie Meng » Sat May 24, 2014 6:26 pm

Hi all,

Thank you very much for reading this topic. My problem is as follows: I built a new plugin called “osimpressureactuator.dll” based on Visual Studio 2010 in Win 64 system. My OpenSim and Matlab are both x64. I have tested my plugin in OpenSim GUI and it worked pretty well. But when I am using the method in “using plugin via Matlab” mentioned in OpenSim website: http://simtk-confluence.stanford.edu:80 ... ng+Plugins. It not really works. I cannot load the plugin via loadlibrary() in Matlab. The loadlibrary() function need a header file, but I do not actually have the .h file of the generated .dll file. Because when VS2010 was generating the plugin, no so such kind of files generated. Then I tried to using the .h that I used to make the plugin instead. It turn out that the method cannot be used for C++, just as what Brad had mentioned before :https://simtk.org/forums/viewtopic.php?f=91&t=3942.

Now I am trying to use C-MEX to load the DLL, but I haven't solved this problem. Any suggestions will be appreciated!

Thanks a lot!

Xiangjie

User avatar
Xiangjie Meng
Posts: 15
Joined: Wed Sep 05, 2012 8:09 pm

Re: Problem of loading plugin in Matlab scripting

Post by Xiangjie Meng » Mon May 26, 2014 7:31 am

Hi All,

Problem solved. I used the DLL_API __declspec(dllexport) and DLL_API __declspec(dllimport) and solved the loading plugin problem in Matlab. Just writing a header file and loading the DLL via loadlibrary() will be fine. Please see the following website: http://cog-mach.blogspot.com/2009/08/in ... irect.html.

Thanks,
Xiangjie

POST REPLY