Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing libraries written in OCaml and C++ from Ruby code

Tags:

c++

ruby

ocaml

I'm writing a Ruby program and I want to use the following libraries in it:

  • LTL3 tools
  • AT&T FSM library
  • LTL2BA library

LTL3 tools are written in OCaml, AT&T FSM library is written in C++, LTL2BA library is written in C++. LTL3 tools have dependencies on AT&T FSM library and LTL2BA library. I have both executables and source code for all those libraries.

How can I access all these libraries from Ruby code? Sorry for noob question, it's my first week in Ruby. BTW I'm using Linux Ubuntu if that helps.

like image 795
user1848394 Avatar asked Nov 23 '12 20:11

user1848394


1 Answers

The simplest way to interact with a library written in a different language is not to find an API bridge to make it run as part of your program, but to have it run as a different process to which you pipe data (in text format, or whatever it easily supports).

From the description, L3LTools seems to be used for converting some sort of stuff into another sort of stuff, and it can read and print them in a documented textual format, and there is a shell script wrapper that does the plumbing for you.

You don't even need to know in which language it's written in. Just get a parser for its output format, a printer for its input format, and call the script from your code.

like image 98
gasche Avatar answered Sep 27 '22 00:09

gasche