[libvirt] Redesigning Libvirt: Adopting use of a safe language

Richard W.M. Jones rjones at redhat.com
Wed Nov 15 18:04:29 UTC 2017


As a point of reference, libguestfs started to allow OCaml in the
daemon this summer, so effectively you can now use OCaml to implement
libguestfs APIs.  (I'm not suggesting libvirt should use OCaml).

Some points:

 - We have a mixed C / OCaml daemon.  The vast majority of the code is
   still C and will most likely always be in C.

 - This is an incremental approach.  We can add new APIs in OCaml, or
   convert existing APIs from C to OCaml, but mostly existing APIs are
   left alone.

 - Our use of a generator makes this easier.  The complexity is
   embedded in the generator.  Developers just need to select whether
   an API is written in C or OCaml, and of course implement/
   reimplement the API in the chosen language, and the generator
   handles the heavy lifting.

 - OCaml-implemented APIs are less code & safer, while being just as
   fast.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the libvir-list mailing list