NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

sizeof(container)?

Hi, I have to interface TS directly to a DLL supplied by a third party. As part of the DLL call interface, structures(containers) are passed back and forth.

I have built type for the structures and set them up as C++ structures. Howeverm the interface also wants the sizeof() the structure itself not just a pointer to it.

In C, I always used sizeof(structname). How do I get the container (structure) size from TS?

rjmiller
0 Kudos
Message 1 of 6
(3,964 Views)
To rjmiller -
TestStand has no way of reading the header file and knowing this. sizeof() only works within C/C++. You will have to determine this manually or add the line of code to a function call and see what it returns.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 6
(3,964 Views)
Thanks Scott. Can TS determine the sizeof a TS container?

rjmiller
0 Kudos
Message 3 of 6
(3,964 Views)
To rjmiller -
A TS container is an object which can have references to other objects, so there is not way to determine a size because it is not continuous in memory.

If the object is a type and structure packing settings for the type are specified, TestStand knows how to pack and unpack the object data into a struct parameter of that type.

I guess the struct passing settings dialog box could display what it thinks that the corresponding size is for the struct, but it currently does not do this.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 4 of 6
(3,964 Views)
That would be a very nice enhancement, especially with the packing rules being applied. I just got caught simply counting bytes and forgetting the packing rules and ended up writing a little C routine which returned the sizeof() the structures I was interested in - OK when you have the compiler I guess (:-

rjmiller
0 Kudos
Message 5 of 6
(3,964 Views)

Hello, Any change with the lasts versions of TestStand?

0 Kudos
Message 6 of 6
(2,472 Views)