LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Sequence Context into Call Library Function Node

How can I pass TestStand's Sequence Context into LabView's "Call Library Function Node", where the function prototype is:
void __declspec(dllexport) __stdcall TheFunction(struct IDispatch *seqContextDisp);
I tried the closest option:
void TheFunction(void *seqContextDisp);
Data format: "Handles by Value".
Data flow:
1. TestStand calls "func.vi" using LabView adapter, and passes "ThisContext" into it.
2. "func.vi" calls "Call Library Function Node", and passes Sequence Context  into it.
3. TestStand reports error:
"Call Library Function Node in func.vi
LabVIEW: An exception occurred within the external code called by a Call Library Function Node.
This might have corrupted LabVIEW's memory. Save any work to a new location and restart LabVIEW.
[Error Code: 1097] "
 
TestStand version: 3.5.0.725
LabView version: 8.2
 
How make it works?
 
Thanks, Misha
 
 
 
 
 
0 Kudos
Message 1 of 17
(4,735 Views)

Hi,

Why are you calling this via a VI, why dont you call it direct from TestStand?

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 17
(4,709 Views)

Hi,

According to our facility's policy, test sequence should contain only homogeneous steps. Each sequence step is a LabView module call.

Some common functionality provided by means of additional API, which is available from LabView modules. This API is in form of "C" dll.

Thanks, Misha.

0 Kudos
Message 3 of 17
(4,706 Views)

Hi,

That seems to be very restrictive and limits the flexibility of TestStand.

I'm not sure you can convert the Reference passed from TestStand to your LabVIEW VI into a IDispatch type to pass to your dll function call.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 4 of 17
(4,699 Views)

Ray,

Actually, if I use (IDispatch**) parameter type in "Call Library Function Node", and change function prototype to:

"void __declspec(dllexport) __stdcall TheFunction(struct IDispatch ** seqContextDisp);", it works, but makes impossible to call "TheFunction(&ThisContext)" directly from TestStand. In this case TS reporting the following error:

"Could not accept the parameters passed in. Only values of type 'Object Reference' may be passed 'By Reference' for this parameter.
Error in parameter 1, 'seqContextDisp'.".

What should be TheFunction() signature to satisfy both: TestStand and LabView?

Thanks, Misha.

0 Kudos
Message 5 of 17
(4,694 Views)
Hi,

In your TestStand function "void __declspec(dllexport) __stdcall TheFunction(struct IDispatch ** seqContextDisp);" there is a double pointer, indicating two levels of indirection.  The LabVIEW call "TheFunction(&ThisContext)" uses the "address of" operator, basically providing one level of indirection.  You are seeing this error because there are different levels of indirction.  Can you change the TestStand function to a single pointer?
0 Kudos
Message 6 of 17
(4,686 Views)

Brian!

This is exactly a point:

LabView not accepts (IDispatch*) but (IDispatch**)

and vice versa

TestStand not accepts (IDispatch**) but (IDispatch*)

Thanks, Misha.

0 Kudos
Message 7 of 17
(4,677 Views)

Hi Misha,

I would be glad to help you with this issue. I am currently trying out several different methods of passing the Sequence Context between LabVIEW and a C DLL, and I will let you know once I have found a working method. Are you using CVI to program your DLL, or another C compiler?

Regards,

Casey Weltzin
Applications Engineer
National Instruments

 

0 Kudos
Message 8 of 17
(4,653 Views)

Hi,

I am using:

Microsoft Visual C++ 2005

Microsoft Visual C++ 6.0

CVI 8.0.1

LabView 8.2

Thanks, Misha

0 Kudos
Message 9 of 17
(4,648 Views)

Hi Misha,

After working on this issue for many hours, I have not yet found a way to correctly pass the TestStand Sequence Context from LabVIEW to a CVI DLL. I will continue to research potential solutions to your problem, but at this point I would very strongly recommend that you simply call your CVI DLL directly from TestStand.

Being able to call code in different forms is one of the great advantages to using TestStand in the first place, so I think putting a limitation of a single adapter type on your sequence is quite restrictive. Your current question is a great example of that advantage; passing the Sequence Context from TestStand directly to a CVI DLL takes roughly 30 seconds to code and works great!

Perhaps it would help if you could explain your requirement of "homogeneous steps". What goal is this meant to accomplish? By calling a DLL through LabVIEW from TestStand, you are greatly increasing the complexity of your application without reducing the need for external libraries.

As I mentioned above, I will continue working to investigate possible solutions to this issue. Have a great day Misha!

Regards,

Casey Weltzin
Applications Engineer
National Instruments 

0 Kudos
Message 10 of 17
(4,628 Views)