Calling a method in a library that has an "HandlePtr" argument

1 次查看(过去 30 天)
Hello I am trying to get a Z stage working with matlab. The Vendor (Dover Motion) have shared their dll. This is the first time I've dived into this part of matlab, so please excuse my lack of knowledge (I'm not really a c or c++ programmer either)
So I've read I need to use loadlibrary (and I've used an alias)
loadlibrary(lib_name,h_name, 'alias','lib') % lib is alias name for C-Motion library
libisloaded('lib') % Check to see its loaded OK
libfunctions('lib') % List methods in the command window
libfunctionsview('lib') % List methods in fancy graphic!
This works fine, and I get a nice graphic showing the methods/functions.
One of those functions I want to use is: PMDSetupAxisInterface_Serial
This is where I am stuck - with the argument (tagPMDAxisHandlePtr) - I don't really know what i'm doing but have tried.
I've read that to call a method inside a dll, to use calllib, so I have tried:
handle = libstruct('tagPMDAxisHandle');
%handle = libpointer('tagPMDAxisHandle');
calllib('lib','PMDSetupAxisInterface_Serial',handle,0,1)
But it cause matlab to crash.
Here's the output of
handle = libstruct('tagPMDAxisHandle');
handle =
lib.tagPMDAxisHandle
and
handle = libpointer('tagPMDAxisHandle');
handle =
libpointer
Thnaks for any help
Jason

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call C from MATLAB 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by