[Mono-dev] [PATCH] Marshaling booleans as U1

Zoltan Varga vargaz at gmail.com
Wed Oct 17 17:22:41 EDT 2007


Hi,

This is ok to check in.

          Zoltan

On 10/17/07, Bill Holmes <billholmes54 at gmail.com> wrote:
> I ran across some code in my app that marshaled boolean types as U1
> and was receiving a g_warning from the mono runtime.  "marshalling
> bool as native type %x is currently not supported"
>
> Changing my code to I1 is easy enough but I wonder if U1 should be
> supported.  This patch does that.
>
> I had to look at two different sites on msdn to determine if it should
> be supported, and it appears that it is.
>
> http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.unmanagedtype.aspx
>
> http://msdn2.microsoft.com/en-us/library/t2t3725f(VS.80).aspx
>
> Collectively they state that...
> I1 : A 1-byte signed integer. You can use this member to transform a
> Boolean value into a 1-byte, C-style bool (true = 1, false = 0).
>
> and
>
> U1 : 1-byte integer value where the value 1 represents TRUE and 0
> represents FALSE.
>
> And for my own curiosity of how things work my question is; without
> this patch a boolean marshaled as U1 will go to the default case and
> marshal a 32 bit integer.  Will this mess up the arguments passed to
> the C function call because the size being pushed is bigger than the C
> function expects?
>
> thanks
> -bill
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>



More information about the Mono-devel-list mailing list