[Gambas-user] Help for libmodbus TCP

bb adamnt42 at gmail.com
Fri Sep 23 09:24:18 CEST 2022

On Fri, 2022-09-23 at 08:16 +0200, fabien.toniutti at free.fr wrote:
> Public Sub Button1_Click()
> Dim mb As Modbus_t()  
> '<--------------------------------------------------- error here
>    mb = New Modbus_new_tcp("", 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
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

>From the Fine Help:
Sometimes an external function returns a pointer, and this pointer will
be required in order to invoke subsequent calls to the external
library. This case is much like creating a Form, and using its
reference to operate on the form itself. In this case, the data behind
(pointed by) the pointer is said to be "opaque": we can not see through
something opaque, so we don't know, and we don't want to know. This is
the simplest case; an example about this is the LDAP library. The first
thing to do to interact with LDAP is to open a connection to a server.
All the subsequent operations will be made on the connection created by
a specific call. Things go like this:

LIBRARY "libldap:2"
PRIVATE EXTERN ldap_init(host AS String, port AS Integer) AS Pointer
PRIVATE ldapconn as Pointer
ldapconn = ldap_init(host, 389)
IF ldapconn = NULL THEN error.Raise("Can not connect to the ldap

 and from the Fine Help for libmodbus:


see especially what the function returns....


More information about the User mailing list