Azzera filtri
Azzera filtri

Issues using LOADLIBRARY in MATLAB deployed program using MATLAB Compiler.

7 visualizzazioni (ultimi 30 giorni)
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 Commento
jgg
jgg il 12 Gen 2016
Modificato: jgg il 12 Gen 2016
Have you tried to add the thunk file to the executable produced? You can use the -a option when you call mcc to include the thunk dll in the archive. See here for related.

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 12 Gen 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.

Categorie

Scopri di più su C Shared Library Integration in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by