Next: Stand-alone interfaces, Previous: C compilers, Up: Top [Contents][Index]
The Mercury allows the code of a procedure
to be specified in a target language
using a pragma foreign_proc declaration.
A procedure may have more than one pragma foreign_proc declarations,
provided they are in different languages.
A procedure that has some pragma foreign_proc declarations
may also have a Mercury definition.
If the language specified in a ‘foreign_proc’ is not available for the selected backend, it will be ignored, and the implementation will use the procedure’s Mercury definition. If there isn’t one, the compiler will generate an error.
This is the only foreign language
whose pragma foreign_procs are used when targeting C.
This is the only foreign language
whose pragma foreign_procs are used when targeting C#.
This is the only foreign language
when whose pragma foreign_procs are used targeting Java.