[Mono-list] array && interop && delegate-callback && performance problem
Lloyd Dupont
lloyd@galador.net
Mon, 24 Sep 2001 13:23:13 +0200
i have a C# project with some C interop code like this
**************************
typedef void (* READCALLBACK) (void * buf, int num, int sizeElem);
void myFunction(READCALLBACK fct);
***************************
i want to call myFunction from C# and give it a delegate as argument.
the trouble is that the delegate should take a pointer argument and i
want to fill this buffer by calling some System.IO.Stream method, which
takes byte[] as argument.
so i have 2 solution:
the immediate one. create a temp buffer, call stream method wih it, copy
my buffer in the void *.
but my problem is with the second (far better) method.
array in C# are SAFARRAY struct in C (with MS .Net, at last) so i
though, i could "cook" a home made safe array whose buffer (pvData)
would be replaced by my data...
As SAFEARRAY is fewly documented this would be cooking and this leads me
to my first question. my cooking will surely (after some test) work with
MS.Net but what about Mono ?
and could somebody advice me on such topics, to write a nice cooking ?