several dynamic arrays is shared memory

I wonder how i can use several dynamically allocated arrays in the shared memory.
After some googling i found the following solution

extern shared int s_d1[];
shared int *s_d2 = &s_d1[num_el_in_s_d1];

where one has to pass the total size of the shared memory to be allocated as a third argument in the kernel.

However if I perform this then I get the following error message:

error: initializer not allowed for shared variable

Is there a standard way to do this? How does this change if one includes shared arrays of different variable types?

Remove [font=“Courier New”]shared[/font] from the second declaration, as that would place the pointer itself in shared memory. The compiler is smart enough to detect that the memory pointed to is shared memory.

Terrific! Thanks!