Passing Structured Data Types Between TestStand and a LabVIEW DLLPrimary Software: TestStandPrimary Software Version: 3.0 Primary Software Fixed Version: N/A Secondary Software: LabVIEW Run-Time Engine
Problem: I have created several LabVIEW code modules to be called from TestStand. These VIs take clusters for their inputs and outputs. When I call the VIs directly with the LabVIEW adapter, it is very easy. However, I have compiled my VIs into a DLL, and I can't seem to figure out how to call the DLL in TestStand and still pass in the VI clusters correctly. How can I do this? Solution: The first thing to check is to make sure the LabVIEW DLL was built with the standard calling convention. This option is set when building the DLL within LabVIEW. For more information on building LabVIEW DLLs, see the tutorial in the related links section. The next step in communicating with the LabVIEW DLL is to define a custom data type for the clusters being passed to the DLL. In general, inside TestStand, LabVIEW clusters are represented as a container, and a custom data type (container) must be defined for each cluster. Follow the steps below to create a custom data type for the LabVIEW cluster: First, the LabVIEW DLL must be built with the standard calling convention to be interpreted properly within TestStand. Define a structured type in TestStand for each cluster type that needs to be passed to/from the DLL. You can do this by creating a new type in the Custom Data Types section of the Sequence File Types view or in a Type Palette. Create the TestStand container and the data types within the container. In the Properties window of your structured types, you need to configure the C Struct Passing tab:
You can refer to the StructPassing example provided with TestStand if you need help. This example demonstrates how to pass a TestStand container as a LabVIEW cluster to a LabVIEW function. The container used is composed of several different data types. The LabVIEW VIs are compiled into a DLL and called as functions. Be aware that LabVIEW VIs always use a 1 byte packing scheme when passing clusters as parameters. Refer to the StructPassing TestStand shipping example located at <TestStand>\Examples\StructPassing\LabVIEW for further information.Related Links: KnowledgeBase 3KPBEO73: Calling Functions, in a C/C++ DLL, that have a C Struct as a Parameter from TestStand Developer Zone Tutorial: Building DLLs in LabVIEW 6.x or later Attachments:
Report Date: 05/31/2006 Last Updated: 07/02/2008 Document ID: 3XU5DUDO |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
