Showing results for 
Search instead for 
Did you mean: 

Bug in the C++/Datalayer interface? Arrays

Long-established Member

Bug in the C++/Datalayer interface? Arrays

A customer is currently working with arrays in the datalayer. In particular he tested ardouble, arint and arstring. He noticed two things:

1. ardouble rounds down the values, which are entered in the datalayer, so that no decimal places arrive in the C++ program (arint works, as far as I could judge, without problems). He looked at the buffer data (data.m_value.buffer.buffer) in the Variant object and could already see there that the double value is only entered rounded into the buffer:


In the upper image, the double values read byte by byte result in 1 and 2, although the values 1.1 and 2.2 were entered in the datalayer.
If the Variant object is created directly with double values, these are also stored correctly in the buffer:


A good way to check the conversion is to use an IEEE double converter: e.g.  and a calculator that can convert decimal values to hex values.

2. Arstring still adds quotes before and after the string. Also this behavior occurs only if the data comes from the datalayer:
Without datalayer:


With datalayer:


3. Furthermore he noticed that if a variable is registered (provider->registerNode) and written directly afterwards, the writeSync method returns DL_INVALID_ADDRESS. If you wait a bit after registering (e.g. with this_thread::sleep_for(100ms)), this error does not occur.
Our assumption is that the register method is executed asynchronously in the background and the write method is called before the datalayer has finished registering the node.
Can the registering of the node be executed synchronously to avoid this behavior and if so, how or what are the alternative ways to fix the problem?

Occasional Contributor

Re: Bug in the C++/Datalayer interface? Arrays

Hello redford, 

thanks for reporting these issues. 

  1. Regarding the first bug you mentioned: This is a known bug of the data layer web browser. This will get fixed with the next release (V1.18)
  2. Regarding the second issue: This is also a known bug of the data layer web browser. It will get fixed with the next release (V1.18)
  3. For a quick workaround you can either loop over the read if your client can`t access the data or wait in your code for some milliseconds after the registerNodes(). 

Best regards,