[Mono-dev] Why is UnmanagedType_80 required?

Raja R Harinath rharinath at novell.com
Wed Aug 31 06:04:16 EDT 2005


Raja R Harinath <rharinath at novell.com> writes:

> Kornél Pál <kornelpal at hotmail.com> writes:
>>>> According to my experiences using no ArraySubType has the same result as
>>>> ArraySubType = (UnmanagedType)80 on mcs and csc.exe as well.
>>>> Could someone tell me please why UnmanagedType_80 is required?
>>>There was a bug in ancient versions of mcs wrt. constant folding in
>>>attribute arguments.  We needed to declare an explicit enumeration
>>>constant, and use that instead.
>> I think in this case we could simply eliminate UnmanagedType_80 in favour of
>> using no ArraySubType as I think we support those ancient versions no more.
>>>The actual reason for using '(UnmanagetType) 80': probably corcompare.
>> Using no ArraySubType and using ArraySubType = (UnmanagedType)80 results in
>> the same binary file.
> I don't think so.  It will be emitted in the MarshalAsAttribute metadata.

Hmm...  I spoke too soon.  It's a pseudo-attribute.  With no
ArraySubType specified, the current mcs compiler code seems to set the
element type of the LParray marshaller to 'int' (I4).  ArraySubType set
to '80' i.e. MAX, specifies to the marshaller that there's "no info"
about the element type.

Either way, I think there should be a difference in the metadata.

- Hari

More information about the Mono-devel-list mailing list