07-07-2011 04:02 AM
Hi,
For a project, we developped some DLL with Labwindows CVI 2010 with dedicated GUI, working marvelously well...
The idea is to reuse these DLL with Teststand to increase test process reliability and speed.
DLL is build around a structure where is stored many parameter necessary to handle the job (kind of context)(have a look below for example)
The problem is how to declare, allocate and use these structure with TestStand.
I followed guide : http://digital.ni.com/public.nsf/allkb/226759075AE83ADF862571E0006D2DB3 and exported my structure adding type library resource to the DLL, which seems, according to my comprehension, necessary to use structure with TestStand.
Now,
how to reimport this structure inside TestStand (despite i'm fairly comfortable with CVI, i'm a beginner under TestStand),
how to declare an object refering to this structure ?
Important : According to the number of parameter inside the structure, it's not acceptable to re-declare each field inside TestStand.
Thanks in advance.
Damien.
An example could be :
#pragma pack (1)
typedef struct {
int StepMachine;
void* data
[...]
} Context;
Each of function of the DLL receive this structure as parameter,
int DoJob (Context *Current, int *ReturnedValue);
07-07-2011 08:58 AM
There's an example in TestStand that should help you figure this out - from the help file:
Demonstrates how to pass a TestStand collection as a C-style struct to a function in a DLL. This example uses functions to pass the struct by both reference and value. For a DLL function to change the value of a TestStand collection, you must pass the collection's reference to the function.
![]() |
Note When you configure the collection as a custom data type, be aware of the byte-packing the DLL function uses. |
<TestStand Public>\Examples\StructPassing\C\Struct Passing to C DLL.seq
This, along with Chapter 13 of the Using LabVIEW and LabWindows/CVI with TestStand manual should help you figure this out.
Hope this helps.
-Jack