Henry Jones

Henry Jones

  • NA
  • 2
  • 0

Null function pointer... how do I do this in C#?

Nov 25 2005 12:05 AM
Hi Friends.......


OSINT OSFNDEF x25xcall
(
OSINT OSDTPTR cid,
OSINT waitmode,
OSINT port,
OSINT info,
struct x25data OSDTPTR facility,
struct x25data OSDTPTR udata,
char OSDTPTR remote,
char OSDTPTR local,
void (OSFNPTR post)(struct x25doneinfo *)
);

I beleive I have almost got it... but not quite. I find the last part
(the void (OSFNPTR post)(struct x25doneinfo *) ) confusing...

So far, I have:

[DllImport("ex25.dll")]
public static extern int x25xcall
(
ref int cid,
int waitmode,
int port,
int info,
ref x25data facility,
ref x25data udata,
ref char remote,
ref char local,
???????
)
plz tell me how to convert the last parameter which is null function pointer which takes struct object as a parameter.
I write The Delegate for the same
The delehgate is

public struct x25doneinfo
{
public int xi_len;
public string xi_buf;
public int xi_cid;
public int xi_cmd;
public int xi_info;
public int xi_retcode;
public PostDelgate post;
//[MarshalAs(UnmanagedType.AsAny)] object xi_ref;
};
x25doneinfo doneinfo = new x25doneinfo() ;
public delegate void PostDelgate(ref x25doneinfo doneInfo );


But when i Call The function x25xcall it gives Error
Object Reference Not Set.....

intCall =x25xcall( 0, 0, 1 , 0,ref sFacil ,ref sUdata , null, null, post) ;


Plz Help

Henry.......