CUDA 3.2 host-compilation

In the early versions of CUDA nvcc tool had host-compilation option which was very useful when you compiling library and linking in to C-program (not C++). In CUDA 3.2 host-compilation option is depricated and nvcc always create c++ object file, so I can’t link object file created with nvcc with c-program created with gcc. Is there any solution of such problem?

Declare functions that you want to call from C code as [font=“Courier New”]extern “C”[/font]. In the header file that is used from both C and CUDA you’ll have to use conditional compilation:

#ifdef __cplusplus

extern "C"