NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Reliablity of using CVI dll in testStand

Solved!
Go to solution

Hello,

 

I have written a .dll using CVI and am trying to use functions available in it using TestStand. I am getting strange errors, not always though when I run TestStand. Here is my code in dll.

 

 

int GetAverage (double* aBuffer, unsigned int aSize, double* aAverage)
{
	double total = 0;
	enum t_eErrorCode eErrorCode = 0;
	
	if(aSize <= 0)
	{
		eErrorCode = eARRAY_SIZE_ZERO;
		goto Error;
	}  
	for(int i = 0; i < aSize; i++)
		total += aBuffer[i];
	*aAverage = total / (aSize);
Error:
	return eErrorCode;
	
}

 It only sometimes throws an error eError_SIZE_ZERO, although when I checked in TestStand debugger, the size sent to the function was not zero (please see attachment).

What can be the reason or what am I doing wrong?

 

Thanks in advance,

RB



 

0 Kudos
Message 1 of 4
(3,092 Views)

Hi RB

 

This sounds really strange.

Maybe there is a TpyeCast problem.

TS stores all its numbers a double. So you TS will cast!

 

If possible I would set a breakpoint on Error in CVI or i would place a second

errorcode to check if it is < 0 

 

Hope this helps

 

Juergen 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 4
(3,069 Views)

Hello Juergen,

 

I can try that.

 

I think you mean that I am passing 64 bits to CVI and since aSize is declared there as "unsigned int" it is considering only LSB which are all zeros. But if this is tha case then it should always be zero I think.

 

Do you know if I can step into a dll and debug it? Somehow it should be possible because I remember that once I had an exception in dll and TestStand asked me "If I wanted to debug it" and stepped into the dll code.

 

Thanks and regards

RB

0 Kudos
Message 3 of 4
(3,066 Views)
Solution
Accepted by topic author dotNet_to_LabW

Hi,

 

This Link should help you with the Debug.

 

Regards
Ray Farmer
Message 4 of 4
(3,058 Views)