Using preprocessor and extern functions in OpenCL kernels

Is it possible for C preprocessor directives to be used in an OpenCL kernel? I want to use macros in my kernel. For example, a simple indexing macro to simulate matrix access in an array:

#define ROWCOLSIZE   10 
#define D2(x,y)   ((x)*ROWCOLSIZE + (y))

It says they are supported but I can’t seem to get them to work unless they are defined directly IN the kernel source. But this is not efficient, particularly if I have hundreds of directives.

Do you need a build argument? Otherwise can you use external functions in your kernel?

Ahhhh they have to be in the program source. Sorry I am braindead. Got it…