Passing managed callback class to unmanaged code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kenneth Porter

    Passing managed callback class to unmanaged code

    I have an unmanaged library that can accept an instance of an abstract
    class and call back into it. I'm writing a wrapper for this library.

    How do I wrap a managed callback in a class derived from the unmanaged
    class to pass to the library?

    I tried creating a managed class that carries an unmanaged callback class
    which calls back into the managed class, but I can't put a handle to the
    unmanaged class in the unmanaged class. (I get C3265.) So how does the
    unmanaged wrapper carry something to let it call up into the managed code?
  • Kenneth Porter

    #2
    Re: Passing managed callback class to unmanaged code

    As usual, no sooner do I frame the question than I find the answer. In this
    case, it's the gcroot template class.

    A HOWTO article:



    Comment

    Working...