Jump to content
  • Advertisement
Sign in to follow this  
Mathius21

C++/CLI Protection Level Error in C#

This topic is 4031 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I was trying to import a c++ class into a c# program, and I made a c++/cli wrapper for it, and in my c# app I can create the object for the dll ok, and I can see the functions it has, but when I try to call a function that has a return type of the class name in the c++ dll, it says "CManagedDirectXWrapper.GetInterface() is inaccesible due to its protection level" //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 Any ideas? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!