[Mono-devel-list] P/Invoke question
Jonathan Pryor
jonpryor at vt.edu
Sun Aug 22 10:16:37 EDT 2004
On Sat, 2004-08-21 at 18:56, Julio David Quintana wrote:
> I'm trying to write bindings for rrdtool (librrd.so) and have run across
> a triple-pointer situation that I'm not quite sure how to handle.
>
> Code:
> int rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize)
Well, you could always use IntPtr, or `ref IntPtr', or...
A better question is this: what does `prdata' represent? Is it an "out"
pointer to an array of strings? Is it a triply-indirected single
character pointer (unlikely, but possible). Is it an "in" pointer to a
3-D matrix?
You need to know what you're dealing with to properly P/Invoke with it.
Also important: if `prdata' is an "out" array of strings, what is the
memory allocator? malloc(3)? g_malloc()? GlobalAlloc()?
CoTaskMemAlloc()?
For more information, see:
- The "Managed and Unmanaged Code Integration" guide, in monodoc
(/Mono Handbook/Advanced Topics/Interoperability/Platform Invoke),
or http://www.jprl.com/~jon/interop.html.
- Interop Marshaling at MSDN (beware line wrapping):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconinteropmarshaling.asp
- Jon
More information about the Mono-devel-list
mailing list