Brandon said:
In 7.0, there is no way to do this. With the 7.1 compiler, the native
classes are public by default. For most people, this wasn't the
desired behavior. Hence, there is a compiler switch to make all
native types private to an assembly (at which point, there is no
solution to your problem again).
I am working with 7.1. I did use __declspec(dllexport) and
__declspec(dllimport) and a header file and it worked, but I think what you
are saying is that I need not have used that and could use #using and it
would still have worked.
It does seem as if the solution should be that __nogc classes are 'private',
just like normal non-.NET C++ classes in a DLL and:
1) One uses __declspec(dllexport) and __declspec(dllimport) and a header
file to access them
Or
2) The compiler recognizes a 'public' keyword for __nogc classes and allows
them to be exported and imported using .NET metadata just like __gc and
__value classes, and one uses #using to access them.
The type in the assembly doesn't actually have metadata (well, it has
next to no metadata). So, in order to use the type from another
assembly, a header file must say what to make of that type. #using
that type from an assembly, acts like a forward declaration for the
type.
I don't follow the above paragraph. Are you saying that if I had a #using
statement for my assembly which has __nogc classes that it would work
without needing to #include the header file ?
In Whidbey, we will allow you to write public and private on a native
class defintion.
Good idea !