[m-rev.] for review: stand-alone interface and non-C grades
Julien Fischer
jfischer at opturion.com
Thu Dec 4 16:29:59 AEDT 2014
For review by anyone.
Stand-alone interfaces and non-C grades.
Clarify the situation with stand-alone interfaces and non-C grades. The
documentation currently says that they are not currently supported for the
non-C grades, which is inaccurate. They are not actually required for the Java
and C# backends. The may however be needed for Erlang.
doc/user_guide.texi:
Stand-alone interface are *not* required if the target language is
C# or Java.
compiler/mercury_compiler.m:
Fix an XXX: generate a more accurate error message if
'--generate-standalone-interface' is used with one of the
non-C target languages.
Julien
diff --git a/compiler/mercury_compile.m b/compiler/mercury_compile.m
index acf502e..f6ddfc6 100644
--- a/compiler/mercury_compile.m
+++ b/compiler/mercury_compile.m
@@ -471,11 +471,18 @@ main_after_setup(DetectedGradeFlags, OptionVariables, OptionArgs, Args,
( Target = target_il
; Target = target_csharp
; Target = target_java
- ; Target = target_erlang
),
- % XXX this message is nonsense. These targets do
- % not require standalone interfaces since they natively
- % provide an equivalent mechanism.
+ NotRequiredMsg = [
+ words("Error:"),
+ quote("--generate-standalone-interface"),
+ words("is not required for target language"),
+ words(compilation_target_string(Target)),
+ suffix(".")
+ ],
+ write_error_pieces_plain(Globals, NotRequiredMsg, !IO),
+ io.set_exit_status(1, !IO)
+ ;
+ Target = target_erlang,
NYIMsg = [
words("Sorry,"),
quote("--generate-standalone-interface"),
diff --git a/doc/user_guide.texi b/doc/user_guide.texi
index 20f7f64..3f79b20 100644
--- a/doc/user_guide.texi
+++ b/doc/user_guide.texi
@@ -10959,8 +10959,15 @@ the argument of @samp{--generate-standalone-interface} option.
@c XXX Mention that stand-alone interfaces work with debugging or
@c (deep) profiling?
-Stand-alone interfaces are not currently supported for target languages
-other than C.
+Stand-alone interfaces are @emph{not} required if the target language is Java
+or C#.
+For those target languages the Mercury runtime will be automatically
+initialised when the classes or library assemblies containing code generated
+by the Mercury compiler are loaded.
+
+Stand-alone interfaces are not currently supported when the target language is
+Erlang.
+
For an example of using a stand-alone interface see the
@samp{samples/c_interface/standalone_c} directory in the Mercury distribution.
More information about the reviews
mailing list