Passing values to cuda dll through extern variable

Hi,

I have a dll (a shared lib actually) with cuda code that uses several extern variables. Those variables must be defined by the calling app. My cuda code goes something like that:

extern int X;

global cuda_func__() {
//use of variable X
}

but the compiler says that X is undefined in function cuda_func. The emulation configuration compiles fine, only the release configuration gives me the error.

The unelegant solution is to rely on the driving app to pass the value of X by calling some init function, but I would rather see the error (variable not defined ba the app) to be detected at compile-time, not at run-time (the app not calling the init function). So is there some other way, like with extern variables above, to pass values to cuda dlls?

All suggestions are appreciated.

OK, I learned my lesson to read the guide thoroughly before jumping into code. I pass values to constant variables correctly now through cudaMemcpyToSymbol.