Next: , Previous: Using pragma foreign_type for C, Up: Interfacing with C   [Contents]


14.10.1.2 Using pragma foreign_export_enum for C

For C the symbolic names generated by a ‘pragma foreign_export_enum’ must form valid C identifiers. These identifiers are used as the names of preprocessor macros. The body of each of these macros expands to a value that is identical to that of the constructor to which the symbolic name corresponds in the mapping established by the ‘pragma foreign_export_enum declaration.

As noted in the C data passing conventions, the type of these values is MR_Word.

The default mapping used by ‘pragma foreign_export_enum’ declarations for C is to use the Mercury constructor name as the base of the symbolic name. For example, the symbolic name for the Mercury constructor ‘foo’ would be foo.