[m-dev.] "executables" in the java grade

Julien Fischer jfischer at opturion.com
Wed Dec 3 18:55:54 AEDT 2014



On Wed, 3 Dec 2014, Paul Bone wrote:

> On Wed, Dec 03, 2014 at 03:12:40PM +1100, Julien Fischer wrote:
>>
>> Hi all,
>>
>> I've recently been experimenting with versions of the Mercury compiler built in
>> the java grade.  With a little bit of fiddling about it is possible to get a
>> working Mercury compiler that runs on the JVM.  One of the main bit of fiddling
>> about is related to how we build "executables" in the java grade.  Currently,
>> when we do
>>
>>     $ mmc --grade java --make foo
>>
>> we end up with a wrapper script (or batch file) in our current working
>> directory plus a bunch of class files in Mercury\classs.  With the current
>> install target in the compiler directory this ends up not working because only
>> the wrapper script ends up being copied into INSTALL_PREFIX/bin, not the class
>> files.  I think a better approach to handling "executables" for the java grade
>> would be to generate a .jar file containing all the program's class files along
>> with the wrapper script and have the wrapper script reference that instead of
>> the class files in the Mercury directory.  Any objections?
>>
>
> None from me.  I think this is the correct thing to do.  However, I suggest
> that there should be an option to disable this behaviour and allow users to
> package up jar files manually.
>  They may have other .class files to put in
> their jar, or they may be using Mercury in the standalone interface style.

We should probably have an equivalent of --link-object for the Java
backend, e.g. something like --extra-class-file, that way users won't
have to package up the files themselves.

There's no such thing as a standalone interface for the non-C backends.
All you need to do is export your predicates to the foreign language and
build as a library.

> We should also check that this works correctly for buidling libraries.

I'm not sure what you mean.

Cheers,
Julien.



More information about the developers mailing list