caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Chan Ngo <chan.ngo2203@gmail.com>
To: Paul Pelzl <pelzlpj@gmail.com>, OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Invoking Java programs from an OCaml program
Date: Wed, 16 Dec 2015 14:29:14 +0100	[thread overview]
Message-ID: <4D6A138A-AA9F-4DFB-85E8-38B44983EC11@gmail.com> (raw)
In-Reply-To: <CANk_VL+bq9ukB_HXtoJ1wAegKTAy+tBx05YPzeqhC8AA6OY93w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]


> On Dec 15, 2015, at 6:21 AM, Paul Pelzl <pelzlpj@gmail.com> wrote:
> 
> On Mon, Dec 14, 2015 at 9:25 AM, Chan Ngo <chan.ngo2203@gmail.com <mailto:chan.ngo2203@gmail.com>> wrote:
> An alternative, if you want to do as follows:
> - Compile Java program to an executable (not jar file)
> - Call this executable and get the return values from it
> 
> So you can think about Unix module in OCaml, you can use the standard I/O to realize a communication channel between your OCaml code and the executable Java.
> https://ocaml.github.io/ocamlunix/ocamlunix.html <https://ocaml.github.io/ocamlunix/ocamlunix.html>
> 
> 
> If the data to be exchanged is structurally complex, then this technique becomes difficult; a cross-platform serialization library can be very helpful for generating appropriate serialization code in multiple languages.  As one example, Cap'n Proto has bindings for both Java and OCaml: https://capnproto.org/otherlang.html <https://capnproto.org/otherlang.html>

Yes, I agree, in some cases, it will become difficult and we need a cross-platform serialization library. Your example is a good point. In addition, if you can control the source code of the Java side, you can modify the code such that it can return the result as JSON object then the OCaml side can get this object value to parse complex data structures.

Best,

---
Chan Ngo
INRIA,
(+33)02 99 84 72 84
chan.ngo@inria.fr
http://people.rennes.inria.fr/Chan.Ngo


[-- Attachment #2: Type: text/html, Size: 2814 bytes --]

  reply	other threads:[~2015-12-16 13:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 16:40 Soichi Sumi
2015-12-14 17:25 ` Chan Ngo
2015-12-15  5:21   ` Paul Pelzl
2015-12-16 13:29     ` Chan Ngo [this message]
2015-12-18 10:25       ` Seungcheol Jung
2015-12-18 22:55         ` Sebastien Ferre
2015-12-21  8:53         ` forum
2015-12-15  9:06 ` forum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D6A138A-AA9F-4DFB-85E8-38B44983EC11@gmail.com \
    --to=chan.ngo2203@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=pelzlpj@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).