//C++ DLL
class __declspec(dllexport)CDirectXDLL
{
public:
CDirectXDLL(void);
void TestFunction() {}
};
CDirectXDLL::CDirectXDLL()
{
return;
}
//Managed DLL
__gc public class CManagedDirectXDLL// : public CDirectXDLL
{
public:
CManagedDirectXDLL(void)
{
return;
}
void Create()
{
m_pDirectX = new CDirectXDLL();
}
CDirectXDLL *GetInterface()
{
return m_pDirectX;
}
.............................................
//C# code, if a function returns CDirectXDLL, it cant access it due to protection level...
public void button1_Click(object sender, EventArgs e)
{
VideoDriver.CManagedDirectXDLL Engine = new VideoDriver.CManagedDirectXDLL();
Engine.Create();//IS OK
Engine.GetInterface()->TestFunction();// error CS0122: 'VideoDriver.CManagedDirectXDLL.GetInterface()' is inaccessible due to its protection level
}