[Mono-list] Re: PInvoke Conventions

Rhys Weatherley rweather@zip.com.au
Thu, 19 Jul 2001 10:01:21 +1000


Steve Newman wrote:

> Nice work.  One minor comment: this describes string parameters as being converted into a pointer to a "native char array".  For out and ref parameters, how do you determine the size for this array?  Seems like this would have to be under programmer control, e.g. specified in a marshalling attribute.

Good catch.  It should be possible to do something like the following:

[MarshalAs(UnmanagedType.ByValArray, SizeConst=1024)]

There are already quite a number of attributes for doing this in the
Windows API.  If there isn't any other information, some default
will no doubt need to be chosen.  BUFSIZ?

I'll probably split strings into a separate section, since they are such
a big issue, and I'll try to capture the most common cases.

Cheers,

Rhys.