[m-users.] documentation for foreign_export_enum

Julien Fischer jfischer at opturion.com
Fri May 22 23:20:00 AEST 2015



On Fri, 22 May 2015, Matthias Güdemann wrote:

...

> ,----
> | :- pragma foreign_export_enum("C", comparison_result/0,
> |                              [
> |                               (<) - "MR_GMP_LT",
> |                               (=) - "MR_GMP_EQ",
> |                               (>) - "MR_GMP_GT"
> |                              ]).
> `----
>
> while this works:
>
> ,----
> | :- pragma foreign_export_enum("C", comparison_result/0, [],
> |                              [
> |                               (<) - "MR_GMP_LT",
> |                               (=) - "MR_GMP_EQ",
> |                               (>) - "MR_GMP_GT"
> |                              ]).
> `----

Incidentally, the Mercury runtime already provides C definitions for the
constructors of the comparison_result/0 type -- see
``C data passing conventions'' in the reference manual.
(The data constructors  can be referred to in C as: MR_COMPARE_LESS,
MR_COMPARE_EQUAL and MR_COMPARE_GREATER.)

Cheers,
Julien.


More information about the users mailing list