Kenneth Adam Miller
2014-10-16 08:08:47 UTC
So, I'm attempting a large library recompile with ocamljava. It's pretty
audacious, because some people in my workplace are rather unwilling to
learn ocaml, yet a very well respected and needed library is authored in
it. Everyone knows java, so we hope very much to recompile the library just
with ocamljava.
Two important things that make me nervous in pursuing this effort are:
1) once fully recompiled, will the library work in java as it did with
native/ocaml byte code?
I've already started modifying the popular OCamlMakefile project to add a
java-byte-code target, and I've found that a threaded example is admitted
by the compiler produces an uncaught exception when run on the JVM... That
example may fall out of what the ocamljava docs has been safely implemented
under ocamljava, I'm not sure...
2) I've noticed that the rather large library that I need to compile, as my
final target, and aside from the toy targets I'm testing ocamljava with,
actually consumes some other C libraries and functions in it's dependency
path...
This is difficult; the traditional OCamlMakefile builds traditional c stubs
to .o files, correctly compiled with ocamlc. But when put on the ocamljava
command line, but ocamljava doesn't know what to do about it. Would there
be any way that I can have support for this ocaml feature as well, or
facilitate some way to link in or enable ocaml code that calls into C being
compiled down to java?
3) What if the answer to 2) is no/no?
If I can't use ocamljava, which is the most desired and elegant way,
allowing beautiful language inter-operation, how can I *best* facilitate
calls to the ocaml library? Is there a fast way to generate callbacks to
ocaml in java or any other language? It's very highly preferable not to
have to delegate back through the JNI due to type safety and fragility.
Alternatively, I looked at the OCaml library Restful, and wondered to
myself if there could be any kind of fast definition between ocaml types
and an exchange language, like json or something. Ideally, I'd like to be
able to generate a url per function in a very very simple declarative
manner, so that I can take ocaml libraries, and make them operate as a
service, where ocaml library functions correspond to URLs.
audacious, because some people in my workplace are rather unwilling to
learn ocaml, yet a very well respected and needed library is authored in
it. Everyone knows java, so we hope very much to recompile the library just
with ocamljava.
Two important things that make me nervous in pursuing this effort are:
1) once fully recompiled, will the library work in java as it did with
native/ocaml byte code?
I've already started modifying the popular OCamlMakefile project to add a
java-byte-code target, and I've found that a threaded example is admitted
by the compiler produces an uncaught exception when run on the JVM... That
example may fall out of what the ocamljava docs has been safely implemented
under ocamljava, I'm not sure...
2) I've noticed that the rather large library that I need to compile, as my
final target, and aside from the toy targets I'm testing ocamljava with,
actually consumes some other C libraries and functions in it's dependency
path...
This is difficult; the traditional OCamlMakefile builds traditional c stubs
to .o files, correctly compiled with ocamlc. But when put on the ocamljava
command line, but ocamljava doesn't know what to do about it. Would there
be any way that I can have support for this ocaml feature as well, or
facilitate some way to link in or enable ocaml code that calls into C being
compiled down to java?
3) What if the answer to 2) is no/no?
If I can't use ocamljava, which is the most desired and elegant way,
allowing beautiful language inter-operation, how can I *best* facilitate
calls to the ocaml library? Is there a fast way to generate callbacks to
ocaml in java or any other language? It's very highly preferable not to
have to delegate back through the JNI due to type safety and fragility.
Alternatively, I looked at the OCaml library Restful, and wondered to
myself if there could be any kind of fast definition between ocaml types
and an exchange language, like json or something. Ideally, I'd like to be
able to generate a url per function in a very very simple declarative
manner, so that I can take ocaml libraries, and make them operate as a
service, where ocaml library functions correspond to URLs.
--
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Caml-list mailing list. Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs