On Wed, Jun 12, 2019 at 01:27:34PM +0200, Martin Kletzander wrote:
Signed-off-by: Martin Kletzander <mkletzan(a)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);
The configure.ac changes are a bit more complex, and this should work
for versions of OCaml which have the bytes type but not this macro.
OCaml 4.02 introduced the bytes type in 2014, so this (probably - I
did not test) fixes things back to then.
So I will push this shortly, thanks.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org