[Mono-list] marshal a struct

Chris Howie cdhowie at gmail.com
Fri Oct 3 12:21:52 EDT 2008

On Fri, Oct 3, 2008 at 6:52 AM, Norbert Lazzeri <elnogge at gmx.de> wrote:
> it does nothing else than adding only those chars to the StringBuilder that
> are not null-Characters. using this code everthing works just fine allthough
> its very ugly i think..

Try using StringBuilder instead of byte[] on the C# side.  The
marshaller should convert this to/from a char* and do
null-termination.  Make sure you construct it as "new
StringBuilder(100)" before passing it to the unmanaged function.

> is this a well known bug of monodevelop or should i better file a bug?

I'd say the effects of the issues with your code do expose an MD bug.
Try Console.WriteLine("foo\0bar") and see if MD shows the "bar".  If
not then this could be considered a bug.

Chris Howie

More information about the Mono-list mailing list