06-09-2008 10:37 AM
I tried searching for this problem but couldn’t find a solution. I run test scripts that call a function in C AA_Dat_Get_Statistic( Stats_Record *p_stats ). If I call this function, I sometimes get system level errors (-17001, -17002), TestStand will sometimes crash, and a load of other problems. These errors do not occur until steps after. If I take out this call, TestStand will not crash. There is an obvious problem with this function.
I wrote a program in C that calls this function. By bypassing TestStand, I avoid crashes too.
Stats_Records contains a few unsigned _int64 variables. The custom struct in TestStand uses another custom struct called Int64. Int64 contains two double variables, High and Low. In short, the variables being passed as a 64 integer are being stored in two 32 double.
Does anyone know if passing by reference an int64 will cause these memory crashes? Is this how I should handle this or is there a better way.
Thanks in advance. ⨪
06-09-2008 10:44 AM
Below is the structure and function:
typedef struct
{
unsigned __int64 frame_count;
double BER;
} Stats_Record;
AA_Dat_Get_Statistics
(int p_card, int p_channel, Stats_Record *p_stats)
{
typedef union
{ __int64 int64_BER;
double float64_BER;
} BER_Union;
....
BER_Union BER;
memset (&aa_stats, 0, sizeof(aaSTATS_
....
aa_status = aa_datGet (aa_handle, aa_channel, AA_DATAID_STATISTICS64, &aa_d_ptr);
p_stats->frame_count = aa_stats.ullFrameCount;
BER.int64_BER = aa_stats.floatCumulativeBER;
p_stats->BER = BER.float64_BER;
return (status);
}⨪
06-10-2008 11:38 AM
06-10-2008 11:44 AM
typedef struct
{
unsigned __int64 frame_count;
double BER;
} Stats_Record;
You can substitute the equivalent structure
typedef struct
{
unsigned int frame_count_part1;
unsigned int frame_count_part2;
double BER;} Stats_Record;