[mercury-users] Working with exported types

Ralph Becket rafe at csse.unimelb.edu.au
Thu Jul 27 15:57:58 AEST 2006


Julien Fischer, Thursday, 27 July 2006:
> Another approach that I have thought about adding (because doing the above
> in the OpenGL binding was fairly tedious), is to add a foreign_enum pragma
> that would allow you to safely use the values of Mercury enums on the other
> side of the foreign language interface, something like:
> 
> 	:- type foo
> 		--->	foo
> 		;	bar
> 		;	baz
> 
> 	:- pragma foreign_enum("C", [
> 		foo - "FOO",
> 		bar - "BAR",
> 		baz - "BAZ"]).
> 
> The compiler would then add the following to the modules .mh file:
> 
> 	#define FOO <representation of foo>
> 	#define BAR <representation of bar>
> 	#define BAZ (representation of baz>

This would be an excellent addition to the FLI.

-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list