[Gambas-user] Help for libmodbus TCP

fabien.toniutti at free.fr fabien.toniutti at free.fr
Fri Sep 23 08:16:25 CEST 2022


Hi everyone,
I try to use libmodbus tcp ip in gambas but i have some questions.
First, i see in libmodbus, source code external methods to extern in 
gambas.
well i write this code :

Extern modbus_t(mb As Object) In "libmodbus"
Extern modbus_new_tcp(myaddress As String, myport As Integer) In 
"libmodbus"
Extern modbus_connect(mb As Object) In "libmodbus"
Extern modbus_read_registers(mb As Object, myaddress As Integer, 
myregister As Integer, tab_reg As Integer[]) In "libmodbus"
Extern modbus_write_registers(mb As Object, myaddress As Integer, 
myregister As Integer, tab_reg As Integer[]) In "libmodbus"
Extern modbus_close(mb As Object) In "libmodbus"
Extern modbus_free(mb As Object) In "libmodbus"

Public Sub Button1_Click()
Dim mb As Modbus_t()  
'<--------------------------------------------------- error here
   mb = New Modbus_new_tcp("127.0.0.1", 1502)
End

but when i execute program, gambas says to me : unknown indetifier 
Modbus_t() (where is arrow above)
Could you explain me how to solve this problem?
is already someone used to program modbus tcpip in gambas on the net? i 
need example.
Thanks a lot for  your answer.
spheris


More information about the User mailing list