My goal is to have ROOT use GPU for part of our code.
With my students, we created compiled a simple program with nvcc, and tried to load it from within ROOT, but this did not work. Compiling the simple program with ROOT instead did work. Details can be found on a question I wrote on StackOverflow.
What can we do in order to compile some of the GPU code with nvcc, and run it from ROOT?
Looking at your StackOverflow question, the first problem is that you do not create appropriate “CINT/CLING dictionary” for your C/C++ functions / classes / …, which you afterwards try to use in CINT/CLING interpreted macros.
When you use ACLiC to pre-compile your macro (e.g. “root TestCompiled.C++”) then it automatically creates the required dictionary “on the fly”.
The simplest trial that you can perform is …
… create a “TestCompiled.h” interface file:
#ifdef __cplusplus
extern "C" {
#endif
void TestCompiled(void);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
BTW. As “nvcc” is a C++ compiler driver which will possibly internally call the same real C++ compiler as ROOT uses, you could maybe get completely rid of any extern "C".
You also need to improve your “TestRoot.C” macro (to make it aware of ROOT 5 versus ROOT 6 differences) -> see the "Test.C” macro in my first post above.