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

A Java ‘pragma foreign_type’ declaration has the form:

:- pragma foreign_type("Java", MercuryTypeName, "JavaType").

The JavaType can be any accessible non-primitive Java type.

The effect of this declaration is that Mercury values of type MercuryTypeName will be passed to and from Java foreign_procs as having type JavaType.

Furthermore, any Mercury procedure exported with ‘pragma foreign_export’ will use JavaType as the type for any parameters whose Mercury type is MercuryTypeName.