Just tried a quick one myself. This works without a problem.
// inside my cuda file (somefile.cu)
extern "C"
dim3* getDimPtr(int x, int y, int z)
{
dim3* threads = new dim3(x, y, z);
return threads;
}
//inside my main.cpp file
extern "C" dim3* getDimPtr(int x, int y, int z); // at the top
// elsewhere in the main.cpp file
dim3* dp = getDimPtr(1, 2, 3);
cout<< dp->x <<" "<< dp->y <<" "<< dp->z <<endl;