Hello
I have a problem with ThreadSafeVars and can not find a solution. maybe someone here can help me...
I like to have an array of an struct as an ThreadSafeVar in my program, but I cant get it to work. What I try is the following:
typedef struct
{
double d1;
double d2;
double d3
double dReserve1; // Reserve
double dReserve2;
double dReserve3;
} SlpItem;
typedef SlpMessungItem SlpArray[12];
DefineThreadSafeVar (SlpArray, Slp);
But this does not work. It gives me a lot of compiler errors. Then I try this:
typedef struct
{
SlpItem Slp[MAX_SLP];
} SlpStruct;
DeclareThreadSafeVar (SlpAnzStruct, AktSlpWerte);
This compiles well and seems to work too. The o
nly thing I do not like is, that the access to the array is not very nice:
SlpStruct *pslp;
pslp = GetPointerToAktSlpWerte();
pslp->slp[1].d1 = 0.0;
...
I always have to write "->slp[x]"
With an array of struct it must be possible to write
SlpArray pslp;
pslp = GetPointerToSlp();
pslp[1].d1 = 0.1;
Does anybody knew, what I am doing wrong?
Thanks
Stephan