I have COM dll that I am using in C++/Cli, one of the method in this COM dll returns IntPtr I want to convert that back to the native object pointer. How I can do that ? please in put
IntPtr is an integral type, you need to first convert it to a pointer type:
IntPtr somePtr;
...
Mumble* fooPtr = (Mumble*)(void*)somePtr;
Or the more readable version:
Mumble* fooPtr = (Mumble*)somePtr.ToPointer();
The method call will be optimized away at runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With