Call MATLAB-created DLL

5 visualizzazioni (ultimi 30 giorni)
Felix
Felix il 3 Mar 2017
Hi,
I'm trying to call a MATLAB created DLL-File in MATLAB but the result is not as expected. I found ot that I have to pass 4 arguments to adress the function but still something is wrong? Following code demonstrates the complete process:
%% Function File
% function OUTPUT = FlipMyString(INPUT)
% OUTPUT = fliplr(INPUT);
%% Call-Test of Function
OUTPUT = FlipMyString('TESTSTRING');
%% Create DLL
mcc -g -v -W cpplib:libFlipMyString -T link:lib FlipMyString
%% Call Library
LIBRARY = 'libFlipMyString';
if ~libisloaded(LIBRARY)
loadlibrary(LIBRARY)
end
LIB = libfunctions(LIBRARY);
[A,B,C] = calllib(LIBRARY,LIB{end},1,'teststring',1,'TESTSTRING')
%% Unload Library
unloadlibrary(LIBRARY)

Risposte (1)

Nagarjuna Manchineni
Nagarjuna Manchineni il 7 Mar 2017
The library (.dll) created using MATLAB cannot be loaded into another MATLAB. A DLL generated by MATLAB Compiler SDK is intended to be used by other applications rather than using it back in MATLAB.
If you would like to share your program with other users who may or may not have MATLAB, you can create an executable using MATLAB Compiler. And, this can be executed in MATLAB using bang operator (!) or System command or from Windows command prompt.

Categorie

Scopri di più su MATLAB Compiler 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