to compensate the lack of VLAs in OpenCL, this tiny trick offers the ability to create them though:

add some extra space characters at the very top of your kernel file (in this case 20)
after reading the kernel file into char* str, but before building the program, do the following:
Code :
	const char * define = "#define M 0x00000008";
 
	memcpy(str, define, 20);
then inside your kernel, the line
Code :
	char message[M];
allocates an array of the size you entered in the host application. the hex value can be created dynamically, so you really have a VLA in OpenCL