ESM_DATA in C++

Hello all,

Is there a way to acces the GDS data in our real time C++ program, without connecting it to ports?
We want to use the ESM_DATA in our C++ program and we hoped we could some how call it directly. When searching in the API docs, I can only find RSC calls, but those can't be used in RT context if I am correct. What would be the way to go?

Arne
Not directly, no (sorry). Is there a reason you can't use port variables?

[quote]RSC calls ... can't be used in RT context if I am correct.[/quote]
You are correct.

[quote]What would be the way to go?[/quote]
If you can't use port variables, then maybe making RSC calls from a Worker Thread in the Component instance and putting the ESM data into a variable that is shared with the Program instance(s). And making sure to using [b]Arp::Mutex[/b](es) to ensure data consistency.

Here is an example showing how data can be shared between Component and Program instances:
https://github.com/PLCnext/CppExamples/tree/master/Examples/ProgramComponentInteraction

Thanks Martin, I will have a look into this. We are using Ports for the IO mappings, but since the esm_data is connected to global variable, copying it to an outport and connecting it with the Cpp program didn’t seem very efficient. I am not completly aware what my collegue wants to do with the data in RT, but he asked it to me and I was also curious. Thanks!

The ESM_DATA variable does not need to be copied to an OUT port variable in order to connect it to an IN port on a program instance. This option requires no code at all apart from the definition of the ESM_DATA struct in C++, and (I think) would be more efficient than using an RSC service from C++ code to get ESM data into your program instance.