NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Struct passing to DLL using the CVI Adapter

Hello,

My question is: how can i pass the struct (container) from the TestStand to DLL, using the C/CVI Standard Prototype Adapter?

Thanks a lot,

Yevgeny
0 Kudos
Message 1 of 5
(3,522 Views)
Hi Yevgeny,

You will find an example on how to do this in the \Examples\StructPassing folder. Also, be aware of the byte packing of the DLL function you are passing the container to. Byte packing is part of the adapater configuration, which you will find in Configure >> Adapter (then choose the adapter you are using to call the DLL and select the Configure button). If you click on Help inside the adapter configuration dialog, the help will tell you what type of byte packing each Application Development Environment uses. In this case, it sounds like you are using CVI, which uses 1- or 8-byte packing depending on the compatibility mode.

I hope that helps.

Best Regards,

Matt P
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,522 Views)
Hi,

Matt is correct. However, you mentioned the Standard CVI Prototype Adapter. Using this adapter, you can only call a function that uses the standard prototype (testData, testError, sequenceContext) required by the adapter. Therefore, you will have to use the DLL Flexible Prototype Adapter. The example that Matt is referring to uses this adapter.

Ryan
0 Kudos
Message 3 of 5
(3,522 Views)
Hi guys,

Thank you for your answeres.

I know that it is possible to pass the struct with DLL adapter, but i prefer to use the Standard CVI Prototype Adapter. Is it possible ot access the struct in this way (using TestStand API)?
0 Kudos
Message 4 of 5
(3,522 Views)
Hi Yevgeny,

Unfortunately, as Ryan said, when you use the Standard CVI Prototype Adapter, you have to adhere to the standard prototype of that adapter (testData, testError, sequenceContext).

Of course you still have the option to access (not pass) the struct through the ActiveX methods - PropertySetVal and PropertyGetVal. For examples of this, see the \Examples\AccessingPropertiesAndVariables folder.

Matt P.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(3,522 Views)