I've written an unmanaged (OO) C++ library that I now want to access from inside C#. I've started building a wrapper in managed C++ for all classes in my library, and so far everything works fine, but I now have an issue I can't resolve nor find anything on (probably I'm searching wrong, but I tried a lot of things).
I'm wrapping a class that has some public data members which are pointers (actually boost::shared_ptr) to other classes in the library. Since these pointers are public, I need to include them in the wrapper so they can be used.
The class looks like this: (leaving out irrelevant parts)
class Application
{
public:
boost::shared_ptr<CLog> Log;
boost::shared_ptr<CKernel> Kernel;
// And some more pointers
Application ();
~Application ();
void Execute ();
};
Wrapping the constructor/destructor/Execute function was easy enough. However, I'm not sure what to do with the pointers to the other classes, since those classes are unmanaged too. One thing I thought of was to write managed versions of these classes as well, and replace the pointers in my managed Application class with pointers to those newly created managed versions of CLog and CKernel. I'm not sure if this is the best/only way to go though, and it seems like a lot of work.
Can anyone tell me how to do this? This is my wrapped class so far:
public ref class cApp
{
private:
Application* application;
public:
cApp()
{
application = new Application();
}
~cApp()
{
delete application;
}
void Execute()
{
application->Execute();
}
};
Thanks a lot in advance for any help!