Issues using LOADLIBRARY in MATLAB deployed program using MATLAB Compiler.
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Walter Roberson
2016-1-12
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 个评论
另请参阅
类别
在 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!