karx11erx

No pointers in global structs?

Discussion created by karx11erx on May 4, 2009
Latest reply on May 25, 2009 by Jawed
Having a pointer in a global struct causes CAL compile errors

I am passing a pointer in a global struct. No variables of the struct's type are used inside kernels, it's only used to pass values to the function that calls the kernels as in the following short example code:

typedef struct tTest { double* a; } tTest;

kernel void TestKernel (float s_in<>, out float s_out<>, float a0, float a1, float a2)
{
s_out = s_in * a0 * a1 * a2;
}

void TestFunc (float* a_in, float *a_out, tTest* t, int n)
{
    float    s_in;
    float s_out;
    float a [3];
    int i;
   
for (i = 0; i < 3; i++)
    a = (float) t.a [ i ];
streamRead (s_in, a_in);   
TestKernel (s_in, s_out, a [0], a [1], a [2]);
streamWrite (s_out, a_out);   
}

This leads to errors in CAL compile step. I cannot quite understand this, as TestFunc should be purely C++.

Not passing the values by a pointer unfortunately is not an option.

Outcomes