[Libguestfs] [libnbd PATCH] Fix building with for ocaml < 4.06.0

Martin Kletzander mkletzan at redhat.com
Wed Jun 12 11:27:34 UTC 2019


Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---

Notes:
    This is the simplest solution suggested to me by Rich and it works.
    
    Most of autotools are not friends with me, so the other approach I tried, with
    requiring at least OCaml 4.05.0, having this fix in only for OCaml < 4.06.0 and
    properly detecting and reporting that, was a bit ugly.
    
    You can see the configure.ac part of it here: http://ix.io/1L0o
    
    If that is preferred, then I can send that one instead.

 ocaml/nbd-c.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ocaml/nbd-c.h b/ocaml/nbd-c.h
index 558581850807..45ae64d77209 100644
--- a/ocaml/nbd-c.h
+++ b/ocaml/nbd-c.h
@@ -27,6 +27,11 @@
 #include <caml/memory.h>
 #include <caml/mlvalues.h>
 
+// Workaround for OCaml < 4.06.0
+#ifndef Bytes_val
+#define Bytes_val(x) String_val(x)
+#endif
+
 extern void libnbd_finalize (value);
 extern void nbd_buffer_finalize (value);
 
-- 
2.21.0




More information about the Libguestfs mailing list