I need an array of images in my kernel (so I can pass multiple images without runtime-generating the kernel code), but I have failed to make this work (and have not found anything in spec that would forbid it)

as this would require something like "__global __read_only image2d_t * textures", which doesn't compile (due to syntax errors on multiple modifiers), I have "typedef __read_only image2d_t i2; ... __global i2 * textures", which partly works.

for "packing" I have a simple runtime-generated kernel, that copies the image2d_t objects to a buffer with size sizeof(cl_mem)*texture_count, but when I try to read these images I get a linker error (on nvidia implementation, don't have access to ATi hardware)

the error can be simply replicated by simple kernel with typedef (included further down), which brings me to think that the problem is not in having arrays of (or pointers to) image objects, but rather in incorrect handling of typedef.
Code :
typedef __read_only image2d_t i2;
__kernel void test_kernel(i2 texture, __global float4 * out)
{
int2 coords=(get_global_id(0),get_global_id(1));
const sampler_t texsampler = CLK_NORMALIZED_COORDS_FALSE|CLK_ADDRESS_REPEAT|CLK_FILTER_LINEAR;
*out = read_imagef(texture,texsampler,coords);
}

this kernel compiles fine if the parameter type is specified without typedefing, but that is not possible with the array case

anoyone has any thoughts? perhaps a quote from the spec saying I can't do this? or a way I can specify array of images without running into syntax or linking errors?