In writing a function within a C++/CLI ref class, I wish to pass a pointer to a pointer to an object when calling a native function.
Native Function
void MyNativeFunc(NativeObject** obj);
Managed C++/CLI Function
ref class ManagedType
{
static NativeObject* m_NativeObj;
void MyManagedFunc()
{
MyNativeFunc(&m_NativeObj); // Error here
}
}
The problem here is that &m_NativeObj
in C++/CLI is not a NativeObject**
. It is an interior_ptr<NativeObject*>
which the native function cannot accept. Is there an syntax such that I can perform this simple reference operation without incurring the managed pointer?
Edit:
Apologies. Initially, the m_NativeObj
was a function member in the question, not a static member of the class. I have the problem only if it is a static member.