How to get the address stored in interior_ptr? RRS feed

  • Question

  • I have a dubugging problem and I'd like to get the address an interior_ptr points to. I can print it using printf("%p", ip) but the whole thing runs inside the SQL CLR where mixed assemblies are not allowed. Also, I'd like to throw and exception with the address in the exception message. I can't find any means of converting an interior_ptr to Int64. Any idea?

    Wednesday, February 29, 2012 1:38 PM


All replies

  • convert interior_ptr to IntPtr, the generic managed handler for pointers.

    Hope this helps!
    Wednesday, February 29, 2012 8:13 PM
  • That was my idea too but neither casting it to IntPtr, nor passing it to the constructor of IntPtr seem to work.
    Thursday, March 1, 2012 7:39 AM
  • I was wrong though...

    interior_ptr ip = &whatever;
    IntPtr ptr = IntPtr(ip);

    actually works.

    Thursday, March 1, 2012 4:40 PM