Failed to load .dll library

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Michael Woodward
Posts: 10
Joined: Tue Jun 20, 2017 3:47 am

Failed to load .dll library

Post by Michael Woodward » Wed May 02, 2018 9:20 am

Hi all

I'm trying to run a user plugin (MuscleForceDirection) for OpenSim3.3 through the MATLAB API. The plugin loads and runs fine in the GUI but when I try to run it through MATLAB I get the following error:

Code: Select all

Failed to load library MuscleForceDirection.dll 
ERROR- library MuscleForceDirection.dll could not be loaded. 
Is there an installation step I'm missing for MATLAB that's specific to the plugin (I've configured MATLAB for OpenSim and added the plugin folder to the MATLAB path)? I've seen a fair few suggestions on the forum to run 'Model.LoadOpenSimLibrary()' but this seems to have no effect.

Cheers

Michael

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Failed to load .dll library

Post by Christopher Dembia » Fri May 04, 2018 3:30 pm

Leave off the ".dll" argument when you invoke `Model.LoadOpenSimLibrary`.

User avatar
Michael Woodward
Posts: 10
Joined: Tue Jun 20, 2017 3:47 am

Re: Failed to load .dll library

Post by Michael Woodward » Tue May 08, 2018 1:58 am

Hi Christopher

I've tried this, but unfortunately the result is the same. Do you have any other ideas?

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Failed to load .dll library

Post by Christopher Dembia » Tue May 08, 2018 10:56 am

Can you share snippets of your code causing the error?

User avatar
Michael Woodward
Posts: 10
Joined: Tue Jun 20, 2017 3:47 am

Re: Failed to load .dll library

Post by Michael Woodward » Thu May 10, 2018 5:36 am

Yeah sure, it's essentially just this:

Code: Select all

plugin2load = 'MuscleForceDirection.dll';

Model.LoadOpenSimLibrary('C:\OpenSim 3.3\plugins\MuscleForceDirection');

dos(['analyze -S ',LoAxml,' -L ', plugin2load], '-echo');
With 'LoAxml' being the path to the settings xml for the analysis.

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Failed to load .dll library

Post by Thomas Uchida » Thu May 10, 2018 8:38 pm

You aren't actually using the OpenSim API through MATLAB when you use the dos() function. I think you want to do something like this:

Code: Select all

myAnalysis = AnalyzeTool(LoAxml);
myAnalysis.run();
See the "setupAndRunAnalyzeBatchExample.m" example on the "Scripting with Matlab" page in the Confluence documentation (https://simtk-confluence.stanford.edu/d ... ith+Matlab).

POST REPLY