[Mono-list] Will COM be supported?
J. Perkins
jason@379.com
06 Jan 2003 13:27:50 -0500
Off the top of my head, might be typos...
On Mon, 2003-01-06 at 13:02, Urs Muff wrote:
> First of all, try to get a reference of a .Net object.
C code
------
void ShowObjectAddr(void* addr)
{
printf("Address is %p\n", addr);
}
C# code
-------
[DllImport("SomeDLL")] static extern void ShowObjectAddr(IntPtr obj);
ShowObjectAddr(this);
> Show me how you would right a C function that calls a method of a .Net
> object.
C code
------
typedef void (__stdcall *CallbackType)();
void CallMe(CallbackType cb)
{
cb();
}
C# code
-------
delegate void CallbackType();
[DllImport("SomeDLL")] void CallMe(CallbackType cb);
void MyCallback()
{
Console.WriteLine("called back");
}
void DoCallback()
{
CallbackType cb = new CallbackType(MyCallback);
CallMe(cb);
}
Feel free to contact me off the list if you need more assistance.
Jason
379