[m-rev.] for review: merge foreign_type pragma on to the main branch

Peter Ross peter.ross at miscrit.be
Tue Oct 23 19:55:25 AEST 2001


On Tue, Oct 23, 2001 at 05:06:38PM +1000, Tyson Dowd wrote:
> On 22-Oct-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > 
> > compiler/ilds.m:
> >     The CLR spec requires that System.Object and System.String be
> >     treated specially in the IL assembly (you have to use the name
> >     object and string instead of the System.* names), so add them as
> >     base types.
> 
> Actually you are adding them as "simple types".
> 
> Are you sure this is the case? 
> 
> il_string_class_name = il_system_name(["String"]).
> il_generic_class_name = il_system_name(["Object"]).
> 
> il_generic_type is defined as System.Object, and we don't seem to have
> problems with that in the IL assembly code.
> 
> Can you tell me what the real problem is, or where this limitation is
> documented?  (or show me an error message or something?).
> 
The .NET framework reported a missing method exception when attempting
to call a method defined in another language.  For example we would have
the following bit of IL generated by the intgen tool to access the
method foo in System.Xml.

    call void System.Xml::foo(class [mscorlib]System.Object)

however the type signature for foo is different

    void System.Xml::foo(object)

This never occurs in generated Mercury code because we always use
System.Object and never object so the signatures appear the same to the
runtime!

For the reference, section 7.2 of Parition II states that CLI builtin
value types (is the reference here to value types a bug in the spec as
System.String and System.Object are builtin types but not value types?)
shall only be referenced in signatures by their special encodings.  See
Parition I section 8.2.2 for the list of all the builtin types which
includes object and string.

Does this help?

Pete
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list