How to get the return value of a c++ function from a .dll in matlab?

2 vues (au cours des 30 derniers jours)
Marcus Heeg
Marcus Heeg le 8 Oct 2019
Hi,
I want to execute a function from a .dll file in matlab. I got this part of the code running:
addpath('C:\Program Files (x86)\Measurement Computing\DAQ')
if not(libisloaded('mccLib'))
loadlibrary('cbw64','cbw.h','alias','mccLib');
end
libfunctionsview('mccLib')
calllib('mccLib','cbFlashLED',0); % LED flashing is working!
Now I want to execute another function with a return value.
The function doc of the .dll in c++ says:
int functionName(arg1,agr2, float *ReturnValue)
And for Visual Basic
Function functionName(arg1&, arg2&, ReturnValue!) As Long
I tried:
x=calllib('mccLib','functionname',1,1);
Error using calllib
No method with matching signature.
Is there a way to get the return value in matlab?
Thanks a lot

Réponses (1)

Peer Blumido
Peer Blumido le 29 Jan 2020
calllib('mccLib','cbFlashLED',0);
0 is the value for turn flash light on?
This " float *ReturnValue" seems like you need a pointer. Did you already solve the problem?

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by