[Mono-dev] Marshalling datatypes

Jonathan Pryor jonpryor at vt.edu
Sat May 31 06:21:50 EDT 2008


On Sat, 2008-05-31 at 15:50 +0800, Euan MacInnes wrote:
> first is a parameter of a function that is a **byte[] array. A *byte[]
> array is more straightforward as that is a Marshal.Copy(), how to do a
> **byte[]?

That's effectively a byte*** parameter.  I think you'll have to marshal
that as a `ref IntPtr`, then use Marshal.Copy(), etc.

> the second is a function call that says it's exported from the lib,
> but mono/C# can't find it:
> 
> The C code in the .h file lists the function as:
> 
> static inline void av_free_packet(AVPacket *pkt)

`static' means "not available for linking from outside this file (or
file that #include this file)".  You cannot P/Invoke it.

(And `inline` means that the compiler should inline all calls to the
function, so even if it weren't `static` it might not exist for linking
anyway...)

You'll have to provide a new function that calls this function, and
P/Invoke the new function.

 - Jon




More information about the Mono-devel-list mailing list