[Mono-list] delegate on P/Invoke

He HongFu hfhe@stryon.com
Thu, 18 Sep 2003 11:31:5 +0000


Hi, all:
=09The P/Invoke can pass a delegate object to native code as a=
 function pointer, for example: the native code as following:
=09
extern "C" PINVOKELIB_API void TestCallBack( FPTR pf, int value=
 )
{
=09bool res =3D (*pf)(value);

=09if( res )
=09=09printf( "Callback returned true.\n" );
=09else
=09=09printf( "Callback returned false.\n" );
}
 
=09Where the pf point to in Mini JIT?

=09when I parsed the the mono JIT, I don't know how the function=
 mono_delegate_to_ftnptr() in marshal.c to pass pointer to=
 native. 
  
    Of course, maybe I get a wrong place for the delegate object=
 to native. Pls help me show the clue how Mini implement callback=
 between Mono and native code.

    Thanks in advance.
=09=09=09=09

=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1He HongFu