I've done this before. I'm not sure how you have your OpenCL code laid out. I typically have all of mine in a separte file (i.e. hello.cl). If I pass a structure to a kernel such as the one you suggested, I will also declare this same structure within hello.cl. Then you can change the value simply by:
structData[ndx]->dataOfInterestToKernel = ndx;
The problem is you are converting between address spaces, which is illegal in OpenCl. The correct way to do this is as follows:
__kernel void test(__global char *structData, uint structSz)
uint ndx = get_local_id(0);
global uint* s = (global uint*)(structData + ndx *structSz);
*s = ndx;
Thanks, that fixes it. Interestingly, the NVidia compiler is not insistent on the memory specifier, but fails later.