I have a function which takes a variable number of pointers, which I would like to modify. It looks something like:
void myPointerModifyingFunction (int num_args, ... ) {
void *gpu_pointer;
char mem_type;
va_list vl;
va_start(vl,num_args);
for (int i=0;i<num_args;i++) {
gpu_pointer=va_arg(vl,void*);
gpu_pointer = CUT_Malloc(100);
}
}
the CUT_Malloc function allocates memory (On the GPU using CUDA) and returns the address. However clearly I am not using the this address properly as gpu_pointer will be destroyed at the end of this function. How can I modify pointers passed as part of a variable argument list?