If I have a non-native interior_ptr pointer in my managed class, then when I cast it to a native pointer to a pointer on the stack (it’s impossible to pass a pointer to interior_ptr pointer) , I’ll pass the correct address, and I’ll write the value that I need to get from an unmanaged code that I do not own?

Or do I have to manually write the resulting pointer into the interior_ptr that lies in the class?

I also add that it is impossible to keep track of the non-constant interior_ptr order to form a native pointer on the stack using the link and not to steam with the entry in the pointer that lies in the class.

The heap object (a member of the managed class) cannot be converted to its own link

  • What is native_ptr? Only something from F # is googling. - MSDN.WhiteKnight
  • @ MSDN.WhiteKnight: Sishny pointer - LLENN
  • interior_ptr is almost an index. With it, you can do everything that you usually do with a pointer, except for returning from a function. If you need a full pointer, only GCHandle.AddrOfPinnedObject. - MSDN.WhiteKnight
  • @ MSDN.WhiteKnight: Yes, this pointer is almost sashny, but I cannot pass it, for example, in Directx methods =) Ie do I need to refer to the pointer and get the native pointer from the pointer via GCHandle ? - LLENN
  • Yes, if the specified variable is in the heap. If stacked or static, it suffices to use pin_ptr. Here there is an example, although it’s well-known, it demonstrates this: ru.stackoverflow.com/questions/785708/… - MSDN.WhiteKnight

0