[Gambas-user] Help for libmodbus TCP
vuott at tutanota.com
vuott at tutanota.com
Fri Sep 23 16:37:26 CEST 2022
Hello b,
thanks for reporting the site.
In fact, as you said, the documentation specifies that « modbus_t context is an opaquestructure containing all necessary information to establish a connection withother Modbus devices » :
https://www.libmodbus.org/docs/v3.1.7/ (there, in "Context" paragraph).
Thanks again
vuott
23 set 2022, 09:24 da adamnt42 at gmail.com:
> 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("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
>>
>> ----[ 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
> server")
>
> and from the Fine Help for libmodbus:
>
> https://www.libmodbus.org/docs/v3.1.7/modbus_new_tcp.html
>
> see especially what the function returns....
>
> b
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220923/264db23a/attachment.htm>
More information about the User
mailing list