I was just designing my first 'major' OpenCL program and was wondering about scoping.

Now the spec says that the CL code is Ansi C, which is fine, but seeing as the file is just cracked open and the source fed into an OpenCL library routine, how exactly does the scoping work?

I mean if I create a program on the CPU per-se, which reads in the kernel code, the kernel code wouldn't have access to a struct defined at the top of the standard C/C++ code, would it? I mean could you even include a common header because of the memory differences? Or do you just have to pass the kernel routines primitive types?

The scoping isn't really intuitive due to how the code is read in and I can't find a lot of resources that explain it clearly.

Thanks!