I came to enjoy DeclareFunctionMBS instead of pure Xojo declares recently.
For a console helper app (Mac/Win) to communicate with a color measurement device, I need to ask the instrument about some settings when it starts.
Here’s the first API method:
and its Xojo equivalent:
var p As Ptr = ExtLib.Symbol("GetAvailableSettings") // extlib = DeclareLibraryMBS instance
var f As New DeclareFunctionMBS("()Z", p)
var b As String = f.Invoke
Return b.Split
That works and returns
Connection_Method;device_ip_address;netprofiler
Which are the constants I can use for another API call:
var p As Ptr = ExtLib.Symbol("GetSettingOptions")
var f As New DeclareFunctionMBS("(Z)Z", p)
f.SetParameters CType(setting, CString)
Var b As String = f.Invoke
If b.IsEmpty Then
MakeDeviceError(CurrentMethodName + " empty result for " + setting)
End If
Return b
No matter which one of the availablesetting constants I use, the result cstring is always empty.
Is my declarefunction definition faulty?