Thanks for your input. I had tried it with the putenv() method. An export in the shell now
works for me also. I had put a call to putenv right before clBuildProgram, I moved it to the
very start of the program and now that works as well. The reason that export in the shell
previously didn't work is that I had left the putenv() call in (probably).