NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

structure

How I can read a fuction that send me an array 1D.
The fuction was built with Labview DLL Builder.
-------------------------------------------------------------------------------------
typedef struct {
long dimSize;
float elt[1];
} TD1;
typedef TD1 **TD1Hdl;

void __cdecl CopyOfCopyOfReadTextFile(char Path[], long indexCol, TD1Hdl *subarray2);
-------------------------------------------------------------------------------------
0 Kudos
Message 1 of 4
(3,355 Views)
Hello,

There are few actions you will want to take to call the function in the DLL and to pass a reference to the struct you are using. You will want to: (1) Create a data type to match the struct; (2) Set the properties of this new type to allow it to be passed as a C Struct; (3) Create a variable of this new type; (4) Use the C/C++ DLL Adapter and insert a step whose code module is the function call.

For details on creating and using a custom data type, refer to Chapter 12 of the TestStand Reference Manual. This chapter includes sections on "Creating and Modifying Custom Data Types" and "Using Data Types".

Here is more on each of the actions mentioned above:

(1) To start, you will want to create a new data type to mirror your struct. You can use the TestStand Container type as an analog to the C Struct. Insert a number for the long and an array of numbers to capture the array of floats in your struct.

You might also find KnowledgeBase 2L7AIT7C: How Do I Create a Container in TestStand? to be a useful document for this action.

(2) Once the data type is created, you will want to right-click the type and select Properties. The Properties dialog includes a C Struct Passing tab. You will want to Allow Objects of This Type to Be Passed as Structs.

Also on this C Struct Passing tab, you will want to select each property of the container and specify the appropriate numeric type. For example, select the Property that matches the long and select Signed 32-bit Integer as the Numeric Type.

(3) Create a local or global variable of this new data type.

(4) Choose the C/C++ DLL Adapter and insert a step in your sequence. You can right-click on the step and select to specify module. The Edit C/C++ DLL Call dialog will be opened.

Select your DLL and your function. You may be warned that No Parameter Information is available. If so, you will need to simply to press the New button to add parameters to the prototype.

For the struct/container parameter, you will want to select the local or global variable you created in (3) as the Value Expression, C Struct for the Category, and your new data type from (1) as the Type.

Once you have completed these four actions, you have successfully configured TestStand to call the function in your DLL.

Regards,

Eric M
0 Kudos
Message 2 of 4
(3,336 Views)
PS. There are examples that ship with TestStand on Passing Structs. You can find these in \Examples\StructPassing folder on your computer.
0 Kudos
Message 3 of 4
(3,333 Views)
Marmalco -
It appears that you are using a LabVIEW generated DLL. Be aware that LabVIEW VIs always use a 1-byte packing scheme when passing clusters as parameters. Also, there is an example, \Examples\StructPassing\LabVIEW\Struct Passing to LV DLL.seq that you might want to look at.
Scott Richardson
https://testeract.com
0 Kudos
Message 4 of 4
(3,283 Views)