Call MATLAB-created DLL

4 visualizaciones (últimos 30 días)
Felix
Felix el 3 de Mzo. de 2017
Respondida: Nagarjuna Manchineni el 7 de Mzo. de 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)

Respuestas (1)

Nagarjuna Manchineni
Nagarjuna Manchineni el 7 de Mzo. de 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.

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by