Thanks for your detailed explanation.
Indeed, I feel that you are very wise about not mixing OCaml and C in the same process. Also, a RPC system (Thrift, etc.) is a good idea for separating high level from low level C stuff, before reimplementing high level stiff in OCaml.
However, this C program is old (which also means more patched and somehow more robust…) and there is quite no more support. And I’m not experienced in C.
This situation is more an opportunity to think about how to use OCaml to program from scratch at “lower level”.
Getting approximately -50% speed would be acceptable.
To go ahead, my main concern is now to extract some specification from the C program. Today, the specification of the program is the C code itself.
It would be useful to get quickly an overview of the C source code instead of reading a bunch of C source files.
Do you think there is a simple way to leverage existing tools to do that, and produce some textual map?
Ideally, getting the OCaml signatures from a/this C program would be great. even if they are low level signatures. I first need to understand the concepts involved in that program.
Totally naive (and crazy?) side question: what about isolating much more components from this C program, and not only high/low level stuff? Just want to know if it’s feasible, even if speed is reduced by 30 or 60%.