Reputation: 10166
I'm trying to call a kernel wrapper foo
from a C++ class. I've tried to do as suggested here below:
// In CPP.h:
class cls {
extern "C" inline void foo();
}
// In Kernels.cu:
#include "CPP.h"
extern "C" inline void cls::foo() {
// call kernels here
}
but this has not worked - I get a compiler errors:
CPP.h: invalid storage class for a class member
CPP.h: "cls::foo" was referenced but not defined
Kernels.cu: label "cls" was declared but never referenced
What's going wrong?
Upvotes: 0
Views: 527
Reputation: 11058
You shouldn't mark a class method with extern "C"
.
Make a wrapper non-member function with extern "C"
specifier, and let this function call your class's method (you will need to specify an instance also).
Upvotes: 2