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

Bill Holmes billholmes54 at gmail.com
Wed Oct 17 10:11:01 EDT 2007

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.



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).


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?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: U1_booleantypes.diff
Type: text/x-patch
Size: 817 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071017/c0d152ee/attachment.bin 

More information about the Mono-devel-list mailing list