Exporting a Type (Class) from a managed dll (assembly)

  • Thread starter Thread starter paul
  • Start date Start date
P

paul

I am exporting a class from a managed dll created in Visual C++ 2005
Express.

In A.h header file I have
// A.h
public ref class A {};

In the same module, I create a new class to be exported which will use
A as its base class.

In B.h header file.
//B.h
#include "A.h"
public ref class B : public A {};

I then try to use class B in the same module in another class called C.


In C.h header file.
//C.h
#include "B.h"
public ref class C { B^ b; };

When trying to compile the above set of classes, I get error C3213: B:
cannot export the derived type with an assembly private base type 'A'

Thanks for the response beforehand!
 
In A.h header file If I change public to private (non exportable)
// A.h
private ref class A {};

I get error C3213: B:
cannot export the derived type with an assembly private base type 'A'
Which is the error I should get.

In A.h header file When I change the private to public (exportable)
// A.h
private ref class A {};

I still get error C3213: B:
cannot export the derived type with an assembly private base type 'A'
This is not the error I should be getting

Hope some one has come across this kind of issue before, and can give
me a hint on how to resolve this problem

paul
 
I have made a correction to the previous post

In A.h header file If I change public to private (non exportable)
// A.h
private ref class A {};

I get error C3213: B:
cannot export the derived type with an assembly private base type 'A'

Which is the error I should get.

In A.h header file When I change the private to public (exportable)
// A.h
public ref class A {}; // not private ref class A {};

I get error C3213: B:
cannot export the derived type with an assembly private base type 'A'

This is not the error I should be getting

Hope some one has come across this kind of issue before, and can give
me a hint on how to resolve this problem

paul
 
Back
Top