[m-dev.] for discussion: pragma foreign_import

Peter Ross peter.ross at miscrit.be
Tue Dec 4 20:46:17 AEDT 2001


On Tue, Dec 04, 2001 at 12:09:31PM +1100, Fergus Henderson wrote:
> On 03-Dec-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Following fjh's previous suggestion here is what the syntax will look
> > like for the IL backend.
> > 
> > :- func cos(float) = float.
> > :- pragma foreign_import(il, cos(in) = out,
> > 		".method public static float64 Cos(float64)"
> 
> Shouldn't this use the IL syntax for class method references (e.g.
> for `call' or `ldftn' instrunctions), rather than the IL syntax for
> method definitions?
> 
> i.e. something more like
> 
> 	:- pragma foreign_import(il, cos(in) = out,
> 		"static float64 [mscorlib]System.Math.Cos(float64)"
> 	).
> 
Yes that is much better, I was thinking I would need the method
definition because I wanted to be able to declare properties as well,
and I thought they used another instruction to access a property.

> >
> > The only problem that I see with this syntax is that nowhere do we mention
> > the assembly which Cos() is contained in.  This information is not needed
> > to generate a call to the Cos method,
> 
> ??  Yes it is, isn't it??
> 
My mistake, it is not needed when the method is local, it is however
needed when the method is contained in another assembly.

Pete
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list