LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

'Designated Inits' in CVI 2015 SP1

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).

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 7
(4,983 Views)

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

0 Kudos
Message 2 of 7
(4,950 Views)

I forwarded a working example to NI support engineer with a ticket number #2706258

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 3 of 7
(4,947 Views)

This seems a bug.

NI support opened CAR ID 618185.

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 4 of 7
(4,904 Views)

I confirm that the CAR is actually under investigation.

 

Licia

0 Kudos
Message 5 of 7
(4,871 Views)

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

 

 

0 Kudos
Message 6 of 7
(4,573 Views)

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

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 7 of 7
(4,394 Views)