Forum: Building VoltDB Clients

Post: OCaml driver ?

OCaml driver ?
Jan 3, 2013
Any plans for OCaml driver anytime soon ?

Jan 7, 2013

Given my limited knowledge of OCaml, it appears that it can call C library functions provided that they are wrapped in something similar to a PHP extension. Is this true or can C functions be directly called?
Re: OCaml driver?
Jan 9, 2013
Yes, there are ways to call C from OCaml. The problems are two-fold:

This process is indirect, as it is with any language calling any other language, and requires special care on our part in dealing with matters such as garbage collection (remembering that OCaml is a garbage-collected language, while C is not)
There is no C driver listed on
There is a C++ driver, so I suppose we could write an OCaml wrapper for C++ code, but as a general rule, it is much more cumbersome to write C++ wrappers than C wrappers.
Jan 10, 2013

The PHP C extension is written against a special c++ driver that does not throw exceptions. If so inclined, you should be able to create a similar C wrapper on the same driver. The "no exceptions" c++ driver was tested on SmartOS, among others, using the PHP C Extension and that C++ driver should be easier to access from an OCaml C library.