Jump to content
  • Advertisement
Sign in to follow this  
WahidB

[.net] Wrap c++ class

This topic is 3286 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

Hello, I have a abstract c++ class inside a dll that I want to wrap in .NET this class has alot of virtual functions. I have been searching for hours on google how to wrap this but I couldn't find any good ways. The only way I have found is this one. So my question is, is there a cleaner way to wrap a abstract class in c++/cli. example:
class Foo
{
public:
Foo(){}
virtual ~Foo(){}
virtual void doStuff() = 0;
virtual void doStuff2() = 0;
};




Share this post


Link to post
Share on other sites
Advertisement
Is this class exported from the DLL?

The thing with virtual function is you'd have to create a derived class that overrides the virtual functions in the DLL(to give them functionality; an intent; a purpose; whatever you wanna call it).

I don't know the specifics with managed C++ but this should be fairly straight-forward if the class is exported from the DLL. http://www.daniweb.com/forums/thread14329.html has some more info. It could also help you if you ask this question in a managed C++ discussion forum.

Share this post


Link to post
Share on other sites
If there are only pure virtual functions the best thing to do might be to define a matching interface in .NET

When there is no implementation at all, why wrap? What's there to wrap?

Share this post


Link to post
Share on other sites
Quote:
Original post by WahidB
Hello,

I have a abstract c++ class inside a dll that I want to wrap in .NET this class has alot of virtual functions. I have been searching for hours on google how to wrap this but I couldn't find any good ways. The only way I have found is this one.
So my question is, is there a cleaner way to wrap a abstract class in c++/cli.


Quote:
Original post by ernow
If there are only pure virtual functions the best thing to do might be to define a matching interface in .NET

When there is no implementation at all, why wrap? What's there to wrap?


I already figured out how to do it but it will require some work.

Share this post


Link to post
Share on other sites
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!