Calling a function in cuda file from a normal C file and passing a structure through it The strcutur

Hi,
I am trying to call a C function in defined in a cuda file through a function in C file.

----------------------------------------------C FILE ----------------------
foo.c file

/* The declaration of the cuda function */
void my_cuda_foo(some structure a);

foo(some structure a) {
my_cuda_foo(a);
}

-----------------------------------------------CUDA FILE ---------------------
foo1.cu file
extern “C” void my_cuda_foo(some_structure a) {
/* The contents of the structure are changed */
}


command lines used to build the files.

gcc -c foo.c
nvcc -c foo1.cu

They are later used to build a large executable. I had two questions. The executable is being build with nvcc.

  1. Is this the correct way to call functions from a C file to a cuda file. Is this approach suitable.
  2. Why are the contents in the structure getting modiffied when i make the call to the cuda function from the c function.

thanks
shankha

I would recomment posting a more complete code sample.