[m-dev.] for discussion: pragma foreign_import

Peter Ross peter.ross at miscrit.be
Thu Dec 6 03:47:38 AEDT 2001


Simon wrote:
> On 03-Dec-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> > Here is a diff to the reference manual for the new foreign_import
> > declaration.
>
> > :- func cos(float) = float.
> > :- pragma foreign_import(il, cos(in) = out,
> > ".method public static float64 Cos(float64)"
>
> Can I suggest using a different name.
>
> `foreign_import' is very similar to `foreign_import_module' but
> they have very different meanings. Maybe `foreign_call' or
> `foreign_proc_call' would be better (this is really just a shorthand
> for a `:- pragma foreign_proc' declaration containing only the call).
>
> `foreign_import' should be used to make the Mercury build system aware
> of dependencies on foreign language header/interface files.
> For example, `:- pragma foreign_import(c, "c_header.h")' would
> be equivalent to `:- pragma foreign_decl(c, "#include
""c_header.h""")',
> but mmake would know about the dependency of the object file on
> `c_header.h'.
>
I was actually planning to switch to using `:- pragma import' but while
developing the new change I was going to accept both syntaxes, just to
make it clear which was which.

However if we decide to keep both versions then I am more than happy to
make the change.

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