[Mono-devel-list] Problem with P/Invoke

Martin Baulig martin at ximian.com
Sun Feb 1 10:07:29 EST 2004

On Sat, 2004-01-31 at 23:27, Jonathan Pryor wrote:
> Thus, your DllImport should be:
> 	[DllImport ("libc.so")]
> 	private static extern IntPtr strncpy (StringBuilder dest,
> 		string src, uint len);
> Now, the bad news begins.  When I try this under Mono 0.29, the code
> doesn't work correctly.  Nothing appears to be copied.

You forgot a more serious issue:

The first argument or strncpy is a `char *' and you can't just overwrite
the managed `StringBuilder' instance.

Martin Baulig <martin at ximian.com>
Now blogging !  http://primates.ximian.com/~martin/blog

More information about the Mono-devel-list mailing list