Yes a custom foreign function interface is needed. In my compiler I did the bare minimum to bootstrap the compiler. Currently you can create a definition module that makes the bridge between the Java and Oberon worlds.
For example the Oberon definition below:
DEFINITION MathUtil;
PROCEDURE ln(x : REAL) : REAL;
END MathUtil.
exposes the Java MathUtil.ln() static method:
public class MathUtil {
public static float ln(float x) {
return (float) java.lang.Math.log(x);
}
}
A client module can use now the Java implementation of ln:
MODULE Client;
IMPORT MathUtil;
VAR x: REAL;
BEGIN
x: = MathUtil.ln(2.0);
MathUtil.ln()
END Client;
For a complete example see
https://github.com/lboasso/oberonc/tree/master/examples/fern