In Visual Studio 2010 I created a Visual C++ CLR class library. Set the build customizations to Cuda 4.0. Created a .cu cuda file. Added a class or two. Wrapped a namespace around it. Compiled. Used the object browser to see what’s up, and noticed the namespace and classes created by nvcc.exe exist. In another .NET project I referenced the assembly. OK fine, no problems so far. Then in the code of the other .NET project I try to use the namespace and the classes I just created (in cuda files compiled by nvcc). Error says “namespace name ‘xyz’ cannot be found (are you missing a using directive or an assembly reference?)” Uh no I’m not. I can see the darn thing with the object browser. It’s right there. What I did notice however is that the class can’t be set to public. nvcc does not allow the word public to preceed class. Without the class being set to public I may not be able to use the class elsewhere, meaning in other assemblies.
How do I make a class public within this cuda language? Where is the formal definition of this nvcc language anyway? I looked around for it on the internet and it wasn’t apparently clear where to find this documentation.
namespace XYZ
{
class MyClass1
{
};
public class MyClass2
{
};
}
For example MyClass1 is proper syntax MyClass2 is not. If the class is not public it cannot be accessed by other assemblies.