I have an managed C++ Wrapper for unmanaged C++ code and it's necessary to use some pointer parameters into the methods!
What's the best way in C# to call this wrapper functions (I tryed it with reference parameter in the managed code and create the pointer and call then the unmanaged code)?
Example:
// c++/managed
Uint32 someMethod(int &value);
Uint32 Wrapper::someMethod(int &value)
{
int *valuePtr = &value;
return unmanagedObj->someMethod(valuePtr);
}
// c++/unmanaged
Uint32 someMethod(int *value);
Uint32 UnmanagedClass::someMethod(int *value)
{
...
}
I use the managed C++ wrapper with "add reference" in VS2008, but when I call someMethod in C# there are only a pointer instead of reference?!
// c#
// e.g. value conversion to C++ pointer
...
Wrapper wrapper = new Wrapper();
wrapper.someMethod(ref value); // should work but here we have an C++ pointer
// and not a reference ?!?!
Thank you for any tips!
greets