export declarations

Peter Schachte pets at students.cs.mu.oz.au
Fri Nov 21 11:55:31 AEDT 1997


As I was reviewing the C interface section of the Mercury manual, I was
struck by the fact that export declarations don't anywhere mention that they
are exporting a predicate or function for invocation using C's calling
conventions.  I think the pragma should really be 

	:- pragma c_export(Pred(Mode1, Mode2, ...), "C_Name_1").

and similarly for functions.  Alternatively, it could be something like:

	:- pragma export(Pred(Mode1, Mode2, ...), c("C_Name_1")).

I think the first form is a little simpler. 

There is no good reason I can think of for the Mercury language (as
distinguished from the current implementation) to imply that C's calling
conventions are the only ones.  This could be changed over a few releases,
as the may_call_mercury argument was added to the c_code pragma.

Of course, the same argument applies (even more) to the import pragma Fergus
proposed in a recent message to this list.


-Peter Schachte			| Politicians are the same all over. They
pets at cs.mu.OZ.AU		| promise to build a bridge even where there is
http://www.cs.mu.oz.au/~pets/	| no river. -- Nikita Krushchev 
PGP key available on request	| 




More information about the developers mailing list