[Mono-dev] [PATCH] Marshaling bools native->managed

Zoltan Varga vargaz at gmail.com
Thu Feb 12 11:25:41 EST 2009


Hi,

  Looks good.

          Zoltan

On Thu, Feb 12, 2009 at 5:13 PM, Bill Holmes <billholmes54 at gmail.com> wrote:
> Hi,
>
> After discussing this patch with Zoltan last night on IRC we decided
> to make two variations of this patch.  One for the trunk and one for
> the 2.4 branch.  The reasoning being that we should not change the
> default behavior of marshaling bools from native to managed this close
> to the branch release.  For the trunk patch we will now marshal bools
> as 32-bit integers by default and for the branch we will continue to
> marshal bools as bytes as it has been done in the past.  In both
> patches if a MarshalAs attribute is specified it will now be
> processed.
>
> This patch does affect all calls from native to managed that include
> bool arguments and is not exclusive to COM.
>
> -bill
>
> trunk:
> 2009-02-13  Bill Holmes  <billholmes54 at gmail.com>
>
>        * object-internals.h : Fixing a typo in the
>          MonoReflectionComVisibleAttribute struct.
>
>        * marshal.c (cominterop_com_visible): Check the implemented
>          interfaces for ComImport.
>
>        * marshal.c (cominterop_get_native_wrapper_adjusted): For COM calls
>          assume that bools should be treated as VARIANTBOOLs.
>
>        * marshal.c (emit_marshal_boolean): Adding cases for
>          MARSHAL_ACTION_MANAGED_CONV_IN and MARSHAL_ACTION_MANAGED_CONV_OUT.
>
>        * marshal.c (mono_marshal_emit_managed_wrapper): Adding calls to
>          emit_marshal MARSHAL_ACTION_MANAGED_CONV_IN and OUT for bools.
>
>        * marshal.c (cominterop_get_ccw): For COM calls assume that bools
>          should be treated as VARIANTBOOLs.
>
>        Code is contributed under MIT/X11 license.
>
> branch:
> 2009-02-13  Bill Holmes  <billholmes54 at gmail.com>
>
>        Backport of r(fill in later).  This is a safer variant of the
>          trunk for the 2.4 branch. The default in emit_marshal_boolean
>          for this version is I1.
>
>        * object-internals.h : Fixing a typo in the
>          MonoReflectionComVisibleAttribute struct.
>
>        * marshal.c (cominterop_com_visible): Check the implemented
>          interfaces for ComImport.
>
>        * marshal.c (cominterop_get_native_wrapper_adjusted): For COM calls
>          assume that bools should be treated as VARIANTBOOLs.
>
>        * marshal.c (emit_marshal_boolean): Adding cases for
>          MARSHAL_ACTION_MANAGED_CONV_IN and MARSHAL_ACTION_MANAGED_CONV_OUT.
>
>        * marshal.c (mono_marshal_emit_managed_wrapper): Adding calls to
>          emit_marshal MARSHAL_ACTION_MANAGED_CONV_IN and OUT for bools.
>
>        * marshal.c (cominterop_get_ccw): For COM calls assume that bools
>          should be treated as VARIANTBOOLs.
>
>        Code is contributed under MIT/X11 license.
>
> On Wed, Feb 11, 2009 at 7:29 PM, Zoltan Varga <vargaz at gmail.com> wrote:
>> Hi,
>>
>>  This looks ok, I'm just concerned that the new code will be run even
>> in non-com situations,
>> and it might cause problems, like it uses CEE_LDIND_I4 to load a bool value.
>>
>>                   Zoltan
>>
>> 2009/2/12 Bill Holmes <billholmes54 at gmail.com>:
>>> Hi,
>>>
>>> The attached patch fixes some problems we are seeing with marshaling
>>> bools and IDspatch types in Native code.
>>>
>>> I can split the patch separating the bool changes form the dispatch
>>> changes if needed.  I would like to apply this to the 2.4 branch as
>>> well.
>>>
>>> -bill
>>>
>>> 2009-02-12  Bill Holmes  <billholmes54 at gmail.com>
>>>
>>>        * object-internals.h : Fixing a typo in the
>>>          MonoReflectionComVisibleAttribute struct.
>>>
>>>        * marshal.c (cominterop_com_visible): Check the implemented
>>>          interfaces for ComImport.
>>>
>>>        * marshal.c (cominterop_get_native_wrapper_adjusted): For COM calls
>>>          assume that bools should be treated as VARIANTBOOLs.
>>>
>>>        * marshal.c (emit_marshal_boolean): Adding cases for
>>>          MARSHAL_ACTION_MANAGED_CONV_IN and MARSHAL_ACTION_MANAGED_CONV_OUT.
>>>
>>>        * marshal.c (mono_marshal_emit_managed_wrapper): Adding calls to
>>>          emit_marshal MARSHAL_ACTION_MANAGED_CONV_IN and OUT for bools.
>>>
>>>        * marshal.c (cominterop_get_ccw): For COM calls assume that bools
>>>          should be treated as VARIANTBOOLs.
>>>
>>>        Code is contributed under MIT/X11 license.
>>>
>>> _______________________________________________
>>> 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