After searching on Google, reading MSDN and checking some codes, I found this method for passing a managed object to an unmanaged function.
These methods show how to convert Object ^ to void * and convert void * to Object ^.
using namespace System; using namespace System::Runtime::InteropServices; void managed_function() { Object^ obj = gcnew Object();
Note: if "unmanaged_function" has variable arguments, this method will not work.
source share