Forum > Networking and Web Programming
OPC client with Lazarus
lagodnol:
Looks like I found the problem. It is related to the optimization of record transfer in Delphi: if the const keyword is specified, the address of the record is transmitted, and not the record itself. It is necessary to remove the const when passing records in imported functions. For example:
--- Code: --- UA_Client_Subscriptions_delete: function(client: PUA_Client; const request: UA_DeleteSubscriptionsRequest): UA_DeleteSubscriptionsResponse; cdecl;
--- End code ---
should be replaced by
--- Code: --- UA_Client_Subscriptions_delete: function(client: PUA_Client; request: UA_DeleteSubscriptionsRequest): UA_DeleteSubscriptionsResponse; cdecl;
--- End code ---
mrogerf:
--- Quote from: Miniekans on May 30, 2023, 01:35:54 pm ---Hello,
I have a strange issue with fpopen and Linux.
open62541 v1.3.3 library built with MSVS 2022 on Windows 10 and everything works fine. I can connect to OPC UA server, read and write values. I use built-in fpopen example.
--- End quote ---
How do you could compile fpopen? I tried code from there and got this error: TestOpcUa1.pas(244,23) Error: Unknown record field identifier "memberTypeIndex"
Thaddy:
Can it be that there is a name clash at play here?
fpopen is a fpc function in the unix rtl... from baseunix.fpopen? --> resolves to unix open.
In that case you can fix that with <your-other-unit-name>.fpopen
Or rename the other fpopen
(since it seems to compile on windows I suspect the name clash, since windows does not use baseunix, so it can use a different fpopen without issue)
mrogerf:
--- Quote from: Thaddy on April 09, 2024, 06:52:16 am ---Can it be that there is a name clash at play here?
fpopen is a fpc function in the unix rtl... from baseunix.fpopen? --> resolves to unix open.
--- End quote ---
No ... it's not the standard fpopen. It's fpopen62541, a freepascal wraper to open62541 OPC UA C library.
Miniekans commented that could successfully compile the example application. But I could not due the errors from my previous post.
ponsdaniel:
Good,
I am testing the example in lazarus to connect to an OPC UA server using the libopen62541.dll library.
The source code is an example that I have found on the net, that other forums have answered working on linux.
Here in windows I can't find the problem because it is not working for me.
I have placed the library in the executable folder, I have placed a path in another folder where the library is.
But I always get the error.
Who can help me?
Translated with DeepL.com (free version)
Navigation
[0] Message Index
[*] Previous page