Page 1 of 1

Failed to load .dll library

Posted: Wed May 02, 2018 9:20 am
by mwoodward
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

Re: Failed to load .dll library

Posted: Fri May 04, 2018 3:30 pm
by chrisdembia
Leave off the ".dll" argument when you invoke `Model.LoadOpenSimLibrary`.

Re: Failed to load .dll library

Posted: Tue May 08, 2018 1:58 am
by mwoodward
Hi Christopher

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

Re: Failed to load .dll library

Posted: Tue May 08, 2018 10:56 am
by chrisdembia
Can you share snippets of your code causing the error?

Re: Failed to load .dll library

Posted: Thu May 10, 2018 5:36 am
by mwoodward
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.

Re: Failed to load .dll library

Posted: Thu May 10, 2018 8:38 pm
by tkuchida
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).