is it possible to pass a reference to a variable of type "mapping" to a function?
I am currently investigating some script at our client. Some function checks that a mapping was asynchronously updated by a callback of a dpQueryConnectAll. The function evaluating the mapping never sees an update.
I have put together this example code doing basically the same as the real script.
The debug output is always "999", but I expect it to change to "123" after about 1 second.
Code: Select all
mapping systems;
main()
{
mapping m;
systems["Test"] = m;
systems["Test"]["value"] = 999;
startThread("CheckMapping", systems["Test"]);
delay(1,0);
systems["Test"]["value"] = 123;
}
void CheckMapping(mapping m)
{
while(true)
{
delay(1,0);
DebugTN("Check", m);
}
}How to avoid copy of string variables, mappings and dyn arrays at function call?
https://www.winccoa.com/knowledge-base/ ... -call.html
But changing the function "CheckMapping" to the following does not change the behaviour. CTRL still makes a deep copy of the mapping.
Or am I mistaken?
Code: Select all
void CheckMapping(mapping &m)
{
while(true)
{
delay(1,0);
DebugTN("Check", m);
}