mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
Initialise standard library in standalone Java example.
samples/java_interface/standalone_java/JavaMain.java:
We need to initialise the standard library, otherwise things
like the stream database won't be set up properly.
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
//
|
||||
import jmercury.runtime.MercuryRuntime;
|
||||
|
||||
// The library class in the jmercury package contains the initialisation method
|
||||
// for Mercury's standard library.
|
||||
import jmercury.library;
|
||||
|
||||
// The mercury_lib class is generated by the compiler when we build
|
||||
// mercury_lib library.
|
||||
//
|
||||
@@ -20,6 +24,12 @@ public class JavaMain {
|
||||
// We do not need to do anything to initialise the Java version of the
|
||||
// Mercury runtime. It will be automatically initialised as the
|
||||
// relevant classes are loaded by the JVM.
|
||||
|
||||
// Initialise the Java version of Mercury's standard library.
|
||||
//
|
||||
out.println("JavaMain: initialising Mercury standard library");
|
||||
library.ML_std_library_init();
|
||||
|
||||
out.println("JavaMain: start main");
|
||||
|
||||
try {
|
||||
@@ -31,7 +41,7 @@ public class JavaMain {
|
||||
// this. This call is (currently) mandatory otherwise the JVM
|
||||
// may not exit cleanly, therefore it should be called in a
|
||||
// finally block as in this example.
|
||||
//`
|
||||
//
|
||||
// This call will invoke any finalisers specified using
|
||||
// ':- finalise' declarations in the set of Mercury libraries we
|
||||
// are using. It also tells the thread pool to shutdown, if the
|
||||
|
||||
Reference in New Issue
Block a user