NI DAQMX Array Size Parameters - ni/grpc-device GitHub Wiki
Many functions in the C API that take in arrays also take in the array size. For example, the C prototype of DAQmxCfgAnlgMultiEdgeStartTrig
is :
int32 DAQmxCfgAnlgMultiEdgeStartTrig (TaskHandle taskHandle, const char triggerSources[], int32 triggerSlopeArray[], float64 triggerLevelArray[], uInt32 arraySize);
Here arraySize
is just the size of the triggerSlopeArray
and triggerLevelArray
parameters.
In the gRPC API, the arraySize
parameter is not present; the gRPC layer automatically determines the correct value to pass in.
This is also true for most output arrays. For example, the C prototype of DAQmxGetErrorString
is:
int32 DAQmxGetErrorString (int32 errorCode, char errorString[], uInt32 bufferSize);
When calling this in C, the convention is to pass in 0 for the bufferSize
, and the return value is the required size of the errorString
array. Then the caller needs to allocate an array of that size and pass that in in a second call.
In the gRPC API, the gRPC layer will automatically determine the size of most output arrays, so the bufferSize
parameter is not present.