11-28-2016 08:04 AM
This document says that CVI 2015 support 'Designated Inits' with warning.
Using CVI 2015 SP1 this instruction
namespaceArray->value.dataSource = (UA_DataSource) {.handle = server, .read = readNamespaces, .write = NULL};
doesn't give any warning and compiles fine, but while executing it produces a 'General Protection' fault.
I suspect this is related to the usage of 'Designated Inits' to set the members of UA_DataSource struct.
Could someone investigate this behavior?
You can see the error trying to run this example from open62541 library (OPC UA).
11-29-2016 02:58 AM
Hello vix,
I tried to run the example but I could not do it.
Please could you post here the screenshot of the error you are getting running this example?
Thank you!
Regards,
Giuseppe
11-29-2016 03:09 AM
I forwarded a working example to NI support engineer with a ticket number #2706258
12-06-2016 12:56 AM
This seems a bug.
NI support opened CAR ID 618185.
12-13-2016 04:14 AM
I confirm that the CAR is actually under investigation.
Licia
04-27-2017 10:17 AM
I've been meaning to try this code in CVI for a while.
The problem is with the line bellow and 4 more like it. It builds but gives you a general protection fail when run:-
namespaceArray->value.dataSource = (UA_DataSource) {.handle = server, .read = readNamespaces, .write = NULL};
If you alter the line to add an interim stage (all 5 instances) then it builds and runs perfectly.
UA_DataSource dtemp = {.handle = server, .read = readNamespaces, .write = NULL};
namespaceArray->value.dataSource = dtemp;
Hope this is some help.
Cheers
07-12-2017 02:16 PM
Hey Vix,
This bug is related to user protection when a structure field of a union contains a pointer and was created with a designated initializer. Aside from initializing the struct first, setting the Debugging Level to "No run-time checking" in the build options should prevent the GPF.
This should be fixed in future versions.
Have a good one!
Trent