Issues using LOADLIBRARY in MATLAB deployed program using MATLAB Compiler.
8 views (last 30 days)
Show older comments
I've tried many fixes to my question and posted a follow up comment ( here ). Am I having issues because my loadlibrary call is part of a class using the "@" format? It's the only difference I can see between what other people have done. Below I've re-posted my issue:
I have followed the instructions here in this comment (and here: link ), but I still get an error when trying to run the exe that I compile. I tried to load the library in a matlab session:
loadlibrary('shrlibsample', @mylibraryfile);
libfunctions('shrlibsample','-full');
and was able to load it fine, I was able to see all the functions, and I was able to run the code I'm trying to package as an exe. However, once I compile (making sure to include both my dll and the 'thunk' dll and the prototype file) and then try to run it fails.
Here's what I've done:
1. Build the prototype
loadlibrary('myDll.dll','myDllLib.h','mfilename','myDllProto');
2. Build exe using Application Compiler App. [my call to loadlibrary in the relevant file (to be compiled) is:
loadlibrary('myDll',@myDllProto);
3. Try to run the newly created exe via a system() call.
4. Execution crashes at the loadlibrary call:
Error using loadlibrary (line 447)
The specified module could not be found.
Error in myObjecConstructor (line 4) [this is the loadlibrary call]
Error in runMyProgram (line 96)
MATLAB:loadlibrary:ThunkLoadFailed
ans =
-1
The loadlibrary call is part of the constructor for a user-defined object (using the @ObjectName folder).
1 Comment
Answers (1)
Walter Roberson
on 12 Jan 2016
loadlibrary() can fail with that message if a dependency is missing. If the shared library needs other libraries you need to be sure they are included in the .exe or present on the target system.
0 Comments
See Also
Categories
Find more on Standalone Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!