Dave
Dave

Reputation: 2386

Accessing Managed Class through Native C++ Plugin

I have a native application which has a native C++ plugin framework that I would like to be able to talk to Managed classes.

In the past I have taken native calls using C++/CLI but I've never had to deal with returning C++/CLI/Managed code back to pure native code.

The most basic API that I have to implement here takes on the form of:

extern "C"  cppPlugin *CreatePlugin(void);                                      
extern      cppPlugin *pluginPtr;

What I would like is to be able to implement cppPlugin using managed code. What are my options here?

Should I write a simple native proxy class in C++/CLI which makes the calls to the managed class or is there a better way?

Upvotes: 1

Views: 129

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564901

Should I write a simple native proxy class in C++/CLI which makes the calls to the managed class or is there a better way?

That is typically the best way. The cppPlugin pointer is a pointer to a native class, so you'll need to implement a native proxy for the managed data, and return that.

Upvotes: 1

Related Questions