[m-dev.] for discussion: pragma foreign_import

Simon Taylor stayl at cs.mu.OZ.AU
Thu Dec 6 03:05:51 AEDT 2001

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

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