All pastes #759600 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-03 09:20 UTC
rendered paste body

//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

        }