caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Make OCaml library available to Java
@ 2016-08-02  4:02 Arlen Cox
  2016-08-02 10:56 ` Malcolm Matalka
  0 siblings, 1 reply; 9+ messages in thread
From: Arlen Cox @ 2016-08-02  4:02 UTC (permalink / raw)
  To: caml-list

Hi all,

I'm trying to figure out what the best way is to make an OCaml library
available to a Java program.  I can think of several ways to do this
each with pros and cons:

1.  OCaml-Java:  This is the most obvious solution that translates the
OCaml code directly to Java.
  + Simple interface to OCaml code
  + Portable Java-compatible code
  + Can easily call back into Java
  - OCaml-Java is a bit buggy
  - Code runs slower

2.  js_of_ocaml:  Translate OCaml to JavaScript and then use the new
"fast" JavaScript engine in Java 8 to execute the JS.
  + Portable Java-compatible code
  + Can call back into Java (albeit, less easily than OCaml-Java)
  - Not type safe interface
  - Possible massive slowdowns or at least unpredictable performance

3.  JNI with C Library:  Wrap OCaml code in a C library and then call
into that with JNI
  + Native OCaml performance
  - Complex GC interaction
  - Not type safe
  - Not portable (need different .so for each platform)
  - No tools to help in doing this (CamlJava is both unsupported and
seemingly unidirectional)
  - No easy call back into Java

Does anyone have any experience with doing this or have any
suggestions on what to do in this situation?

Thanks,
Arlen

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-08-03 12:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02  4:02 [Caml-list] Make OCaml library available to Java Arlen Cox
2016-08-02 10:56 ` Malcolm Matalka
2016-08-02 11:51   ` Arlen Cox
2016-08-02 16:34     ` Gerd Stolpmann
2016-08-02 16:48       ` Arlen Cox
2016-08-02 17:21     ` Pippijn van Steenhoven
2016-08-02 17:34       ` Arlen Cox
2016-08-03 12:43       ` Hendrik Boom
2016-08-03 12:46         ` Jeremy Yallop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).