hello,
i try to call several c/c++ function in a library and have a problem with **void output parameter.
This is the description of the c++ function :
Prototype
int32_t ME100_API ME3_acquireImage(DET_t det, void **dataBuffer, uint32_t *dataSize void **inputsBuffer, uint32_t *inputsSize);
Parameters
- In – det: handle to the detector.
- Out – databuffer: handle to memory allocated by API that stores the lines acquired.
- Out – dataSize: size of allocated buffer.
- Out – inputsBuffer: handle to memory allocated by API that stores the sub-D9 inputs.
- Out – inputsSize: size of allocated buffer.
After using the "clibgen.generateLibraryDefinition" function, i need to missing MLTYPE parameter for this function :
This is what i got for this function :
C++ function ME3_acquireImage with MATLAB name clib.ME100.ME3_acquireImage
C++ Signature: int32_t ME3_acquireImage(DET_t det,void * * dataBuffer,uint32_t * dataSize,void * * inputsBuffer,uint32_t * inputsSize)
%ME3_acquireImageDefinition = addFunction(libDef, ...
% "int32_t ME3_acquireImage(DET_t det,void * * dataBuffer,uint32_t * dataSize,void * * inputsBuffer,uint32_t * inputsSize)", ...
% "MATLABName", "clib.ME100.ME3_acquireImage", ...
% "Description", "clib.ME100.ME3_acquireImage Representation of C++ function ME3_acquireImage." + newline + ...
% "Acquire an image. Must be called between ME3_prepareAcquisition and ME3_unPrepareAcquisition." + newline + ...
% "MUST�NOT�BE�USED when MEDET_startAcquisition has been called", ...
% "DetailedDescription", "This content is from the external library documentation."); % Modify help description values as needed.
%defineArgument(ME3_acquireImageDefinition, "det", "clib.ME100.ME100_base", "input", <SHAPE>, "Description", "[in] det concerned detector");
%defineArgument(ME3_acquireImageDefinition, "dataBuffer", <MLTYPE>, "output", 1, "Description", "[in] buffer memory to store acquired lines"); % <MLTYPE> can be an existing typedef name for void* or a new typedef name to void*.
%defineArgument(ME3_acquireImageDefinition, "dataSize", "clib.array.ME100.UnsignedInt", "input", <SHAPE>, "Description", "[in] size size of buffer, in bytes."); % <MLTYPE> can be "clib.array.ME100.UnsignedInt", or "uint32"
%defineArgument(ME3_acquireImageDefinition, "inputsBuffer", <MLTYPE>, "output", 1); % <MLTYPE> can be an existing typedef name for void* or a new typedef name to void*.
%defineArgument(ME3_acquireImageDefinition, "inputsSize", "clib.array.ME100.UnsignedInt", "input", <SHAPE>); % <MLTYPE> can be "clib.array.ME100.UnsignedInt", or "uint32"
%defineOutput(ME3_acquireImageDefinition, "RetVal", "int32", "Description", "ME_SUCCESS on success, after the image has been acquired.");
%validate(ME3_acquireImageDefinition);
How to define in particular the output parameter "dataBuffer" which is define as a void** in C library and should give the buffer of an 2Dimage ?
This is what i tried :
ME3_acquireImageDefinition = addFunction(libDef, ...
"int32_t ME3_acquireImage(DET_t det,void * * dataBuffer,uint32_t * dataSize,void * * inputsBuffer,uint32_t * inputsSize)", ...
"MATLABName", "clib.ME100.ME3_acquireImage", ...
"Description", "clib.ME100.ME3_acquireImage Representation of C++ function ME3_acquireImage." + newline + ...
"Acquire an image. Must be called between ME3_prepareAcquisition and ME3_unPrepareAcquisition." + newline + ...
"MUST�NOT�BE�USED when MEDET_startAcquisition has been called", ...
"DetailedDescription", "This content is from the external library documentation."); % Modify help description values as needed.
defineArgument(ME3_acquireImageDefinition, "det", "clib.ME100.ME100_base", "input", 1, "Description", "[in] det concerned detector");
defineArgument(ME3_acquireImageDefinition, "dataBuffer", "uint32", "output", "dataSize", "Description", "[in] buffer memory to store acquired lines"); % <MLTYPE> can be an existing typedef name for void* or a new typedef name to void*.
defineArgument(ME3_acquireImageDefinition, "dataSize", "uint32", "output", 1, "Description", "[in] size size of buffer, in bytes."); % <MLTYPE> can be "clib.array.ME100.UnsignedInt", or "uint32"
defineArgument(ME3_acquireImageDefinition, "inputsBuffer", "uint32", "output", "inputsSize"); % <MLTYPE> can be an existing typedef name for void* or a new typedef name to void*.
defineArgument(ME3_acquireImageDefinition, "inputsSize", "uint32", "output", 1); % <MLTYPE> can be "clib.array.ME100.UnsignedInt", or "uint32"
defineOutput(ME3_acquireImageDefinition, "RetVal", "int32", "Description", "ME_SUCCESS on success, after the image has been acquired.");
validate(ME3_acquireImageDefinition);
Building the library give the following error:
>> build(defineME100)
Error using defineME100
Invalid MATLABType specified for argument 'dataBuffer'.
Expected type is one of the following: an existing typedef
name for void* or a new typedef name for void*.
Can you help please?
Thank you
Philippe