The following C function is passed a handle, a parameter string, and a value string. It returns an integer (0 for success, another number if there’s an error). The value I’m looking for, which corresponds to the parameter I’m sending, seems to be handled as a pointer.
COAX_GRABBER_API int32_t GetGrabberParam(int32_t * handle, char * param, char * value);
The size of the value
string is variable - could be a single digit, could be a very long string.
Here’s how I’m calling it now:
var returnValue as int32
var cParam as CString = "DeviceSerialNumber"
var cValue as CString = "XXXXXXXXXXXXX"
returnValue = GetCameraParam(fgHandle, cParam, cValue)
And this is Xojo External Function GetCameraParam:
Private Soft Declare Function GetCameraParam Lib LibCoaxLinkGrabber (byref fgHandle as int32, param as CString, byref cValue as CString) As Integer
But I’m getting back nothing. The DLL’s error logger is showing me the correct text of the parameter I’m calling (“DeviceSerialNumber”), and I know the result is an 11 character long string. The logger says that the size of the result is “11” but the size of “lv string” (what I assume is its internal name for the string I’m passing byref) is only 5.
Doesn’t seem to matter how big I make the string I’m sending it (if I double the number of Xs or if i delete them all and send an empty string, I get the same numbers, 11 and 5, in the logger.
So what’s the best way to retrieve the value string here?