Add a binding for virDomainCreateXML.
[ocaml-libvirt.git] / libvirt / libvirt_c.c
index ca7f303..6e56682 100644 (file)
@@ -6,13 +6,14 @@
  */
 
 /* OCaml bindings for libvirt.
- * (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
+ * (C) Copyright 2007-2015 Richard W.M. Jones, Red Hat Inc.
  * http://libvirt.org/
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2 of the License, or (at your option) any later version,
+ * with the OCaml linking exception described in ../COPYING.LIB.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -72,25 +73,10 @@ ocaml_libvirt_connect_close (value connv)
  * In generator.pl this function has signature "conn : string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRCONNECTGETHOSTNAME
-extern char *virConnectGetHostname (virConnectPtr conn) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_connect_get_hostname (value connv)
 {
   CAMLparam1 (connv);
-#ifndef HAVE_VIRCONNECTGETHOSTNAME
-  /* Symbol virConnectGetHostname not found at compile time. */
-  not_supported ("virConnectGetHostname");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virConnectGetHostname
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virConnectGetHostname);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -102,32 +88,16 @@ ocaml_libvirt_connect_get_hostname (value connv)
   rv = caml_copy_string (r);
   free (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virConnectGetURI.
  * In generator.pl this function has signature "conn : string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRCONNECTGETURI
-extern char *virConnectGetURI (virConnectPtr conn) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_connect_get_uri (value connv)
 {
   CAMLparam1 (connv);
-#ifndef HAVE_VIRCONNECTGETURI
-  /* Symbol virConnectGetURI not found at compile time. */
-  not_supported ("virConnectGetURI");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virConnectGetURI
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virConnectGetURI);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -139,7 +109,6 @@ ocaml_libvirt_connect_get_uri (value connv)
   rv = caml_copy_string (r);
   free (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virConnectGetType.
@@ -194,6 +163,16 @@ ocaml_libvirt_connect_list_domains (value connv, value iv)
   int i = Int_val (iv);
   int ids[i], r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virConnectListDomains (conn, ids, i));
   CHECK_ERROR (r == -1, conn, "virConnectListDomains");
 
@@ -237,6 +216,16 @@ ocaml_libvirt_connect_list_defined_domains (value connv, value iv)
   char *names[i];
   int r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virConnectListDefinedDomains (conn, names, i));
   CHECK_ERROR (r == -1, conn, "virConnectListDefinedDomains");
 
@@ -283,6 +272,16 @@ ocaml_libvirt_connect_list_networks (value connv, value iv)
   char *names[i];
   int r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virConnectListNetworks (conn, names, i));
   CHECK_ERROR (r == -1, conn, "virConnectListNetworks");
 
@@ -329,6 +328,16 @@ ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
   char *names[i];
   int r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virConnectListDefinedNetworks (conn, names, i));
   CHECK_ERROR (r == -1, conn, "virConnectListDefinedNetworks");
 
@@ -346,25 +355,10 @@ ocaml_libvirt_connect_list_defined_networks (value connv, value iv)
  * In generator.pl this function has signature "conn : int".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
-extern int virConnectNumOfStoragePools (virConnectPtr conn) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_connect_num_of_storage_pools (value connv)
 {
   CAMLparam1 (connv);
-#ifndef HAVE_VIRCONNECTNUMOFSTORAGEPOOLS
-  /* Symbol virConnectNumOfStoragePools not found at compile time. */
-  not_supported ("virConnectNumOfStoragePools");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virConnectNumOfStoragePools
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virConnectNumOfStoragePools);
 
   virConnectPtr conn = Connect_val (connv);
   int r;
@@ -373,32 +367,16 @@ ocaml_libvirt_connect_num_of_storage_pools (value connv)
   CHECK_ERROR (r == -1, conn, "virConnectNumOfStoragePools");
 
   CAMLreturn (Val_int (r));
-#endif
 }
 
 /* Automatically generated binding for virConnectListStoragePools.
  * In generator.pl this function has signature "conn, int : string array".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRCONNECTLISTSTORAGEPOOLS
-extern int virConnectListStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
 {
   CAMLparam2 (connv, iv);
-#ifndef HAVE_VIRCONNECTLISTSTORAGEPOOLS
-  /* Symbol virConnectListStoragePools not found at compile time. */
-  not_supported ("virConnectListStoragePools");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virConnectListStoragePools
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virConnectListStoragePools);
 
   CAMLlocal2 (rv, strv);
   virConnectPtr conn = Connect_val (connv);
@@ -406,6 +384,16 @@ ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
   char *names[i];
   int r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virConnectListStoragePools (conn, names, i));
   CHECK_ERROR (r == -1, conn, "virConnectListStoragePools");
 
@@ -417,32 +405,16 @@ ocaml_libvirt_connect_list_storage_pools (value connv, value iv)
   }
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virConnectNumOfDefinedStoragePools.
  * In generator.pl this function has signature "conn : int".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
-extern int virConnectNumOfDefinedStoragePools (virConnectPtr conn) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
 {
   CAMLparam1 (connv);
-#ifndef HAVE_VIRCONNECTNUMOFDEFINEDSTORAGEPOOLS
-  /* Symbol virConnectNumOfDefinedStoragePools not found at compile time. */
-  not_supported ("virConnectNumOfDefinedStoragePools");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virConnectNumOfDefinedStoragePools
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virConnectNumOfDefinedStoragePools);
 
   virConnectPtr conn = Connect_val (connv);
   int r;
@@ -451,32 +423,16 @@ ocaml_libvirt_connect_num_of_defined_storage_pools (value connv)
   CHECK_ERROR (r == -1, conn, "virConnectNumOfDefinedStoragePools");
 
   CAMLreturn (Val_int (r));
-#endif
 }
 
 /* Automatically generated binding for virConnectListDefinedStoragePools.
  * In generator.pl this function has signature "conn, int : string array".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
-extern int virConnectListDefinedStoragePools (virConnectPtr conn, char **const names, int maxnames) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
 {
   CAMLparam2 (connv, iv);
-#ifndef HAVE_VIRCONNECTLISTDEFINEDSTORAGEPOOLS
-  /* Symbol virConnectListDefinedStoragePools not found at compile time. */
-  not_supported ("virConnectListDefinedStoragePools");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virConnectListDefinedStoragePools
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virConnectListDefinedStoragePools);
 
   CAMLlocal2 (rv, strv);
   virConnectPtr conn = Connect_val (connv);
@@ -484,6 +440,16 @@ ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
   char *names[i];
   int r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virConnectListDefinedStoragePools (conn, names, i));
   CHECK_ERROR (r == -1, conn, "virConnectListDefinedStoragePools");
 
@@ -495,7 +461,6 @@ ocaml_libvirt_connect_list_defined_storage_pools (value connv, value iv)
   }
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virConnectGetCapabilities.
@@ -519,6 +484,25 @@ ocaml_libvirt_connect_get_capabilities (value connv)
   CAMLreturn (rv);
 }
 
+/* Automatically generated binding for virConnectDomainEventDeregisterAny.
+ * In generator.pl this function has signature "conn, int : unit".
+ */
+
+CAMLprim value
+ocaml_libvirt_connect_domain_event_deregister_any (value connv, value iv)
+{
+  CAMLparam2 (connv, iv);
+
+  virConnectPtr conn = Connect_val (connv);
+  int i = Int_val (iv);
+  int r;
+
+  NONBLOCKING (r = virConnectDomainEventDeregisterAny (conn, i));
+  CHECK_ERROR (r == -1, conn, "virConnectDomainEventDeregisterAny");
+
+  CAMLreturn (Val_unit);
+}
+
 /* Automatically generated binding for virDomainCreateLinux.
  * In generator.pl this function has signature "conn, string, 0U : dom".
  */
@@ -541,42 +525,27 @@ ocaml_libvirt_domain_create_linux (value connv, value strv)
   CAMLreturn (rv);
 }
 
-/* Automatically generated binding for virDomainCreateLinuxJob.
- * In generator.pl this function has signature "conn, string, 0U : job".
+/* Automatically generated binding for virDomainCreateXML.
+ * In generator.pl this function has signature "conn, string, unsigned : dom".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRDOMAINCREATELINUXJOB
-extern virJobPtr virDomainCreateLinuxJob (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
-ocaml_libvirt_domain_create_linux_job (value connv, value strv)
+ocaml_libvirt_domain_create_xml (value connv, value strv, value uv)
 {
-  CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRDOMAINCREATELINUXJOB
-  /* Symbol virDomainCreateLinuxJob not found at compile time. */
-  not_supported ("virDomainCreateLinuxJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virDomainCreateLinuxJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virDomainCreateLinuxJob);
+  CAMLparam3 (connv, strv, uv);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
   char *str = String_val (strv);
-  virJobPtr r;
+  unsigned int u = Int_val (uv);
+  virDomainPtr r;
 
-  NONBLOCKING (r = virDomainCreateLinuxJob (conn, str, 0));
-  CHECK_ERROR (!r, conn, "virDomainCreateLinuxJob");
+  NONBLOCKING (r = virDomainCreateXML (conn, str, u));
+  CHECK_ERROR (!r, conn, "virDomainCreateXML");
 
-  rv = Val_job (r, connv);
+  rv = Val_domain (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virDomainFree.
@@ -861,46 +830,6 @@ ocaml_libvirt_domain_save (value domv, value strv)
   CAMLreturn (Val_unit);
 }
 
-/* Automatically generated binding for virDomainSaveJob.
- * In generator.pl this function has signature "dom, string : job from dom".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRDOMAINSAVEJOB
-extern virJobPtr virDomainSaveJob (virDomainPtr dom, const char *str) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_domain_save_job (value domv, value strv)
-{
-  CAMLparam2 (domv, strv);
-#ifndef HAVE_VIRDOMAINSAVEJOB
-  /* Symbol virDomainSaveJob not found at compile time. */
-  not_supported ("virDomainSaveJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virDomainSaveJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virDomainSaveJob);
-
-  CAMLlocal2 (rv, connv);
-  virDomainPtr dom = Domain_val (domv);
-  virConnectPtr conn = Connect_domv (domv);
-  char *str = String_val (strv);
-  virJobPtr r;
-
-  NONBLOCKING (r = virDomainSaveJob (dom, str));
-  CHECK_ERROR (!r, conn, "virDomainSaveJob");
-
-  connv = Field (domv, 1);
-  rv = Val_job (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
 /* Automatically generated binding for virDomainRestore.
  * In generator.pl this function has signature "conn, string : unit".
  */
@@ -920,44 +849,6 @@ ocaml_libvirt_domain_restore (value connv, value strv)
   CAMLreturn (Val_unit);
 }
 
-/* Automatically generated binding for virDomainRestoreJob.
- * In generator.pl this function has signature "conn, string : job".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRDOMAINRESTOREJOB
-extern virJobPtr virDomainRestoreJob (virConnectPtr conn, const char *str) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_domain_restore_job (value connv, value strv)
-{
-  CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRDOMAINRESTOREJOB
-  /* Symbol virDomainRestoreJob not found at compile time. */
-  not_supported ("virDomainRestoreJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virDomainRestoreJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virDomainRestoreJob);
-
-  CAMLlocal1 (rv);
-  virConnectPtr conn = Connect_val (connv);
-  char *str = String_val (strv);
-  virJobPtr r;
-
-  NONBLOCKING (r = virDomainRestoreJob (conn, str));
-  CHECK_ERROR (!r, conn, "virDomainRestoreJob");
-
-  rv = Val_job (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
 /* Automatically generated binding for virDomainCoreDump.
  * In generator.pl this function has signature "dom, string, 0 : unit".
  */
@@ -979,46 +870,6 @@ ocaml_libvirt_domain_core_dump (value domv, value strv)
   CAMLreturn (Val_unit);
 }
 
-/* Automatically generated binding for virDomainCoreDumpJob.
- * In generator.pl this function has signature "dom, string, 0 : job from dom".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRDOMAINCOREDUMPJOB
-extern virJobPtr virDomainCoreDumpJob (virDomainPtr dom, const char *str,  int flags) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_domain_core_dump_job (value domv, value strv)
-{
-  CAMLparam2 (domv, strv);
-#ifndef HAVE_VIRDOMAINCOREDUMPJOB
-  /* Symbol virDomainCoreDumpJob not found at compile time. */
-  not_supported ("virDomainCoreDumpJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virDomainCoreDumpJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virDomainCoreDumpJob);
-
-  CAMLlocal2 (rv, connv);
-  virDomainPtr dom = Domain_val (domv);
-  virConnectPtr conn = Connect_domv (domv);
-  char *str = String_val (strv);
-  virJobPtr r;
-
-  NONBLOCKING (r = virDomainCoreDumpJob (dom, str, 0));
-  CHECK_ERROR (!r, conn, "virDomainCoreDumpJob");
-
-  connv = Field (domv, 1);
-  rv = Val_job (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
 /* Automatically generated binding for virDomainSuspend.
  * In generator.pl this function has signature "dom : unit".
  */
@@ -1155,45 +1006,6 @@ ocaml_libvirt_domain_create (value domv)
   CAMLreturn (Val_unit);
 }
 
-/* Automatically generated binding for virDomainCreateJob.
- * In generator.pl this function has signature "dom, 0U : job from dom".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRDOMAINCREATEJOB
-extern virJobPtr virDomainCreateJob (virDomainPtr dom, unsigned  int flags) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_domain_create_job (value domv)
-{
-  CAMLparam1 (domv);
-#ifndef HAVE_VIRDOMAINCREATEJOB
-  /* Symbol virDomainCreateJob not found at compile time. */
-  not_supported ("virDomainCreateJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virDomainCreateJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virDomainCreateJob);
-
-  CAMLlocal2 (rv, connv);
-  virDomainPtr dom = Domain_val (domv);
-  virConnectPtr conn = Connect_domv (domv);
-  virJobPtr r;
-
-  NONBLOCKING (r = virDomainCreateJob (dom, 0));
-  CHECK_ERROR (!r, conn, "virDomainCreateJob");
-
-  connv = Field (domv, 1);
-  rv = Val_job (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
 /* Automatically generated binding for virDomainAttachDevice.
  * In generator.pl this function has signature "dom, string : unit".
  */
@@ -1536,44 +1348,6 @@ ocaml_libvirt_network_create_xml (value connv, value strv)
   CAMLreturn (rv);
 }
 
-/* Automatically generated binding for virNetworkCreateXMLJob.
- * In generator.pl this function has signature "conn, string : job".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRNETWORKCREATEXMLJOB
-extern virJobPtr virNetworkCreateXMLJob (virConnectPtr conn, const char *str) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_network_create_xml_job (value connv, value strv)
-{
-  CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRNETWORKCREATEXMLJOB
-  /* Symbol virNetworkCreateXMLJob not found at compile time. */
-  not_supported ("virNetworkCreateXMLJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virNetworkCreateXMLJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virNetworkCreateXMLJob);
-
-  CAMLlocal1 (rv);
-  virConnectPtr conn = Connect_val (connv);
-  char *str = String_val (strv);
-  virJobPtr r;
-
-  NONBLOCKING (r = virNetworkCreateXMLJob (conn, str));
-  CHECK_ERROR (!r, conn, "virNetworkCreateXMLJob");
-
-  rv = Val_job (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
 /* Automatically generated binding for virNetworkDefineXML.
  * In generator.pl this function has signature "conn, string : net".
  */
@@ -1615,45 +1389,6 @@ ocaml_libvirt_network_create (value netv)
   CAMLreturn (Val_unit);
 }
 
-/* Automatically generated binding for virNetworkCreateJob.
- * In generator.pl this function has signature "net : job from net".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRNETWORKCREATEJOB
-extern virJobPtr virNetworkCreateJob (virNetworkPtr net) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_network_create_job (value netv)
-{
-  CAMLparam1 (netv);
-#ifndef HAVE_VIRNETWORKCREATEJOB
-  /* Symbol virNetworkCreateJob not found at compile time. */
-  not_supported ("virNetworkCreateJob");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virNetworkCreateJob
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virNetworkCreateJob);
-
-  CAMLlocal2 (rv, connv);
-  virNetworkPtr net = Network_val (netv);
-  virConnectPtr conn = Connect_netv (netv);
-  virJobPtr r;
-
-  NONBLOCKING (r = virNetworkCreateJob (net));
-  CHECK_ERROR (!r, conn, "virNetworkCreateJob");
-
-  connv = Field (netv, 1);
-  rv = Val_job (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
 /* Automatically generated binding for virNetworkGetAutostart.
  * In generator.pl this function has signature "net : bool".
  */
@@ -1698,25 +1433,10 @@ ocaml_libvirt_network_set_autostart (value netv, value bv)
  * In generator.pl this function has signature "pool : free".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLFREE
-extern int virStoragePoolFree (virStoragePoolPtr pool) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_free (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLFREE
-  /* Symbol virStoragePoolFree not found at compile time. */
-  not_supported ("virStoragePoolFree");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolFree
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolFree);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -1729,32 +1449,16 @@ ocaml_libvirt_storage_pool_free (value poolv)
   Pool_val (poolv) = NULL;
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolDestroy.
  * In generator.pl this function has signature "pool : free".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLDESTROY
-extern int virStoragePoolDestroy (virStoragePoolPtr pool) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_destroy (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLDESTROY
-  /* Symbol virStoragePoolDestroy not found at compile time. */
-  not_supported ("virStoragePoolDestroy");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolDestroy
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolDestroy);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -1767,32 +1471,16 @@ ocaml_libvirt_storage_pool_destroy (value poolv)
   Pool_val (poolv) = NULL;
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolLookupByName.
  * In generator.pl this function has signature "conn, string : pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
-extern virStoragePoolPtr virStoragePoolLookupByName (virConnectPtr conn, const char *str) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYNAME
-  /* Symbol virStoragePoolLookupByName not found at compile time. */
-  not_supported ("virStoragePoolLookupByName");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolLookupByName
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolLookupByName);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -1805,32 +1493,16 @@ ocaml_libvirt_storage_pool_lookup_by_name (value connv, value strv)
   rv = Val_pool (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolLookupByUUID.
  * In generator.pl this function has signature "conn, uuid : pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
-extern virStoragePoolPtr virStoragePoolLookupByUUID (virConnectPtr conn, const unsigned char *str) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
 {
   CAMLparam2 (connv, uuidv);
-#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUID
-  /* Symbol virStoragePoolLookupByUUID not found at compile time. */
-  not_supported ("virStoragePoolLookupByUUID");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolLookupByUUID
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUID);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -1843,32 +1515,16 @@ ocaml_libvirt_storage_pool_lookup_by_uuid (value connv, value uuidv)
   rv = Val_pool (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolLookupByUUIDString.
  * In generator.pl this function has signature "conn, string : pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
-extern virStoragePoolPtr virStoragePoolLookupByUUIDString (virConnectPtr conn, const char *str) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYUUIDSTRING
-  /* Symbol virStoragePoolLookupByUUIDString not found at compile time. */
-  not_supported ("virStoragePoolLookupByUUIDString");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolLookupByUUIDString
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolLookupByUUIDString);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -1881,32 +1537,16 @@ ocaml_libvirt_storage_pool_lookup_by_uuid_string (value connv, value strv)
   rv = Val_pool (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolGetName.
  * In generator.pl this function has signature "pool : static string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLGETNAME
-extern const char *virStoragePoolGetName (virStoragePoolPtr pool) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_get_name (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLGETNAME
-  /* Symbol virStoragePoolGetName not found at compile time. */
-  not_supported ("virStoragePoolGetName");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolGetName
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolGetName);
 
   CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -1918,32 +1558,16 @@ ocaml_libvirt_storage_pool_get_name (value poolv)
 
   rv = caml_copy_string (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolGetXMLDesc.
  * In generator.pl this function has signature "pool, 0U : string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLGETXMLDESC
-extern char *virStoragePoolGetXMLDesc (virStoragePoolPtr pool, unsigned  int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLGETXMLDESC
-  /* Symbol virStoragePoolGetXMLDesc not found at compile time. */
-  not_supported ("virStoragePoolGetXMLDesc");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolGetXMLDesc
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolGetXMLDesc);
 
   CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -1956,32 +1580,16 @@ ocaml_libvirt_storage_pool_get_xml_desc (value poolv)
   rv = caml_copy_string (r);
   free (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolGetUUID.
  * In generator.pl this function has signature "pool : uuid".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLGETUUID
-extern int virStoragePoolGetUUID (virStoragePoolPtr pool, unsigned char *) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_get_uuid (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLGETUUID
-  /* Symbol virStoragePoolGetUUID not found at compile time. */
-  not_supported ("virStoragePoolGetUUID");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolGetUUID
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolGetUUID);
 
   CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -1996,32 +1604,16 @@ ocaml_libvirt_storage_pool_get_uuid (value poolv)
   rv = caml_alloc_string (VIR_UUID_BUFLEN);
   memcpy (String_val (rv), uuid, VIR_UUID_BUFLEN);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolGetUUIDString.
  * In generator.pl this function has signature "pool : uuid string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
-extern int virStoragePoolGetUUIDString (virStoragePoolPtr pool, char *) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLGETUUIDSTRING
-  /* Symbol virStoragePoolGetUUIDString not found at compile time. */
-  not_supported ("virStoragePoolGetUUIDString");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolGetUUIDString
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolGetUUIDString);
 
   CAMLlocal1 (rv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -2034,32 +1626,16 @@ ocaml_libvirt_storage_pool_get_uuid_string (value poolv)
 
   rv = caml_copy_string (uuid);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolCreateXML.
  * In generator.pl this function has signature "conn, string, 0U : pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLCREATEXML
-extern virStoragePoolPtr virStoragePoolCreateXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEPOOLCREATEXML
-  /* Symbol virStoragePoolCreateXML not found at compile time. */
-  not_supported ("virStoragePoolCreateXML");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolCreateXML
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolCreateXML);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -2072,32 +1648,16 @@ ocaml_libvirt_storage_pool_create_xml (value connv, value strv)
   rv = Val_pool (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolDefineXML.
  * In generator.pl this function has signature "conn, string, 0U : pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLDEFINEXML
-extern virStoragePoolPtr virStoragePoolDefineXML (virConnectPtr conn, const char *str, unsigned int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEPOOLDEFINEXML
-  /* Symbol virStoragePoolDefineXML not found at compile time. */
-  not_supported ("virStoragePoolDefineXML");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolDefineXML
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolDefineXML);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -2110,32 +1670,16 @@ ocaml_libvirt_storage_pool_define_xml (value connv, value strv)
   rv = Val_pool (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolBuild.
  * In generator.pl this function has signature "pool, uint : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLBUILD
-extern int virStoragePoolBuild (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_build (value poolv, value iv)
 {
   CAMLparam2 (poolv, iv);
-#ifndef HAVE_VIRSTORAGEPOOLBUILD
-  /* Symbol virStoragePoolBuild not found at compile time. */
-  not_supported ("virStoragePoolBuild");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolBuild
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolBuild);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2143,35 +1687,19 @@ ocaml_libvirt_storage_pool_build (value poolv, value iv)
   int r;
 
   NONBLOCKING (r = virStoragePoolBuild (pool, i));
-  CHECK_ERROR (!r, conn, "virStoragePoolBuild");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolBuild");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolUndefine.
  * In generator.pl this function has signature "pool : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLUNDEFINE
-extern int virStoragePoolUndefine (virStoragePoolPtr pool) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_undefine (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLUNDEFINE
-  /* Symbol virStoragePoolUndefine not found at compile time. */
-  not_supported ("virStoragePoolUndefine");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolUndefine
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolUndefine);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2181,32 +1709,16 @@ ocaml_libvirt_storage_pool_undefine (value poolv)
   CHECK_ERROR (r == -1, conn, "virStoragePoolUndefine");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolCreate.
  * In generator.pl this function has signature "pool, 0U : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLCREATE
-extern int virStoragePoolCreate (virStoragePoolPtr pool, unsigned  int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_create (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLCREATE
-  /* Symbol virStoragePoolCreate not found at compile time. */
-  not_supported ("virStoragePoolCreate");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolCreate
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolCreate);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2216,32 +1728,16 @@ ocaml_libvirt_storage_pool_create (value poolv)
   CHECK_ERROR (r == -1, conn, "virStoragePoolCreate");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolDelete.
  * In generator.pl this function has signature "pool, uint : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLDELETE
-extern int virStoragePoolDelete (virStoragePoolPtr pool, unsigned int i) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_delete (value poolv, value iv)
 {
   CAMLparam2 (poolv, iv);
-#ifndef HAVE_VIRSTORAGEPOOLDELETE
-  /* Symbol virStoragePoolDelete not found at compile time. */
-  not_supported ("virStoragePoolDelete");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolDelete
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolDelete);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2249,35 +1745,19 @@ ocaml_libvirt_storage_pool_delete (value poolv, value iv)
   int r;
 
   NONBLOCKING (r = virStoragePoolDelete (pool, i));
-  CHECK_ERROR (!r, conn, "virStoragePoolDelete");
+  CHECK_ERROR (r == -1, conn, "virStoragePoolDelete");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolRefresh.
  * In generator.pl this function has signature "pool, 0U : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLREFRESH
-extern int virStoragePoolRefresh (virStoragePoolPtr pool, unsigned  int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_refresh (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLREFRESH
-  /* Symbol virStoragePoolRefresh not found at compile time. */
-  not_supported ("virStoragePoolRefresh");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolRefresh
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolRefresh);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2287,32 +1767,16 @@ ocaml_libvirt_storage_pool_refresh (value poolv)
   CHECK_ERROR (r == -1, conn, "virStoragePoolRefresh");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolGetAutostart.
  * In generator.pl this function has signature "pool : bool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLGETAUTOSTART
-extern int virStoragePoolGetAutostart (virStoragePoolPtr pool, int *r) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_get_autostart (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLGETAUTOSTART
-  /* Symbol virStoragePoolGetAutostart not found at compile time. */
-  not_supported ("virStoragePoolGetAutostart");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolGetAutostart
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolGetAutostart);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2322,32 +1786,16 @@ ocaml_libvirt_storage_pool_get_autostart (value poolv)
   CHECK_ERROR (r == -1, conn, "virStoragePoolGetAutostart");
 
   CAMLreturn (b ? Val_true : Val_false);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolSetAutostart.
  * In generator.pl this function has signature "pool, bool : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLSETAUTOSTART
-extern int virStoragePoolSetAutostart (virStoragePoolPtr pool, int b) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
 {
   CAMLparam2 (poolv, bv);
-#ifndef HAVE_VIRSTORAGEPOOLSETAUTOSTART
-  /* Symbol virStoragePoolSetAutostart not found at compile time. */
-  not_supported ("virStoragePoolSetAutostart");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolSetAutostart
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolSetAutostart);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2359,32 +1807,16 @@ ocaml_libvirt_storage_pool_set_autostart (value poolv, value bv)
   CHECK_ERROR (r == -1, conn, "virStoragePoolSetAutostart");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolNumOfVolumes.
  * In generator.pl this function has signature "pool : int".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
-extern int virStoragePoolNumOfVolumes (virStoragePoolPtr pool) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
 {
   CAMLparam1 (poolv);
-#ifndef HAVE_VIRSTORAGEPOOLNUMOFVOLUMES
-  /* Symbol virStoragePoolNumOfVolumes not found at compile time. */
-  not_supported ("virStoragePoolNumOfVolumes");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolNumOfVolumes
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolNumOfVolumes);
 
   virStoragePoolPtr pool = Pool_val (poolv);
   virConnectPtr conn = Connect_polv (poolv);
@@ -2394,32 +1826,16 @@ ocaml_libvirt_storage_pool_num_of_volumes (value poolv)
   CHECK_ERROR (r == -1, conn, "virStoragePoolNumOfVolumes");
 
   CAMLreturn (Val_int (r));
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolListVolumes.
  * In generator.pl this function has signature "pool, int : string array".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLLISTVOLUMES
-extern int virStoragePoolListVolumes (virStoragePoolPtr pool, char **const names, int maxnames) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
 {
   CAMLparam2 (poolv, iv);
-#ifndef HAVE_VIRSTORAGEPOOLLISTVOLUMES
-  /* Symbol virStoragePoolListVolumes not found at compile time. */
-  not_supported ("virStoragePoolListVolumes");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolListVolumes
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolListVolumes);
 
   CAMLlocal2 (rv, strv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -2428,6 +1844,16 @@ ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
   char *names[i];
   int r;
 
+  /* Some libvirt List* functions still throw exceptions if i == 0,
+   * so catch that and return an empty array directly.  This changes
+   * the semantics slightly (masking other failures) but it's
+   * unlikely anyone will care.  RWMJ 2008/06/10
+   */
+  if (i == 0) {
+    rv = caml_alloc (0, 0);
+    CAMLreturn (rv);
+  }
+
   NONBLOCKING (r = virStoragePoolListVolumes (pool, names, i));
   CHECK_ERROR (r == -1, conn, "virStoragePoolListVolumes");
 
@@ -2439,32 +1865,16 @@ ocaml_libvirt_storage_pool_list_volumes (value poolv, value iv)
   }
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolFree.
  * In generator.pl this function has signature "vol : free".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLFREE
-extern int virStorageVolFree (virStorageVolPtr vol) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_free (value volv)
 {
   CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEVOLFREE
-  /* Symbol virStorageVolFree not found at compile time. */
-  not_supported ("virStorageVolFree");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolFree
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolFree);
 
   virStorageVolPtr vol = Volume_val (volv);
   virConnectPtr conn = Connect_volv (volv);
@@ -2477,32 +1887,16 @@ ocaml_libvirt_storage_vol_free (value volv)
   Volume_val (volv) = NULL;
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolDelete.
  * In generator.pl this function has signature "vol, uint : unit".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLDELETE
-extern int virStorageVolDelete (virStorageVolPtr vol, unsigned int i) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_delete (value volv, value iv)
 {
   CAMLparam2 (volv, iv);
-#ifndef HAVE_VIRSTORAGEVOLDELETE
-  /* Symbol virStorageVolDelete not found at compile time. */
-  not_supported ("virStorageVolDelete");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolDelete
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolDelete);
 
   virStorageVolPtr vol = Volume_val (volv);
   virConnectPtr conn = Connect_volv (volv);
@@ -2510,35 +1904,19 @@ ocaml_libvirt_storage_vol_delete (value volv, value iv)
   int r;
 
   NONBLOCKING (r = virStorageVolDelete (vol, i));
-  CHECK_ERROR (!r, conn, "virStorageVolDelete");
+  CHECK_ERROR (r == -1, conn, "virStorageVolDelete");
 
   CAMLreturn (Val_unit);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolLookupByName.
  * In generator.pl this function has signature "pool, string : vol from pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
-extern virStorageVolPtr virStorageVolLookupByName (virStoragePoolPtr pool, const char *str) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
 {
   CAMLparam2 (poolv, strv);
-#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYNAME
-  /* Symbol virStorageVolLookupByName not found at compile time. */
-  not_supported ("virStorageVolLookupByName");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolLookupByName
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolLookupByName);
 
   CAMLlocal2 (rv, connv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -2553,32 +1931,16 @@ ocaml_libvirt_storage_vol_lookup_by_name (value poolv, value strv)
   rv = Val_volume (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolLookupByKey.
  * In generator.pl this function has signature "conn, string : vol".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
-extern virStorageVolPtr virStorageVolLookupByKey (virConnectPtr conn, const char *str) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYKEY
-  /* Symbol virStorageVolLookupByKey not found at compile time. */
-  not_supported ("virStorageVolLookupByKey");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolLookupByKey
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolLookupByKey);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -2591,32 +1953,16 @@ ocaml_libvirt_storage_vol_lookup_by_key (value connv, value strv)
   rv = Val_volume (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolLookupByPath.
  * In generator.pl this function has signature "conn, string : vol".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
-extern virStorageVolPtr virStorageVolLookupByPath (virConnectPtr conn, const char *str) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
 {
   CAMLparam2 (connv, strv);
-#ifndef HAVE_VIRSTORAGEVOLLOOKUPBYPATH
-  /* Symbol virStorageVolLookupByPath not found at compile time. */
-  not_supported ("virStorageVolLookupByPath");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolLookupByPath
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolLookupByPath);
 
   CAMLlocal1 (rv);
   virConnectPtr conn = Connect_val (connv);
@@ -2629,32 +1975,16 @@ ocaml_libvirt_storage_vol_lookup_by_path (value connv, value strv)
   rv = Val_volume (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolCreateXML.
  * In generator.pl this function has signature "pool, string, 0U : vol from pool".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLCREATEXML
-extern virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool, const char *str, unsigned  int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
 {
   CAMLparam2 (poolv, strv);
-#ifndef HAVE_VIRSTORAGEVOLCREATEXML
-  /* Symbol virStorageVolCreateXML not found at compile time. */
-  not_supported ("virStorageVolCreateXML");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolCreateXML
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolCreateXML);
 
   CAMLlocal2 (rv, connv);
   virStoragePoolPtr pool = Pool_val (poolv);
@@ -2669,32 +1999,16 @@ ocaml_libvirt_storage_vol_create_xml (value poolv, value strv)
   rv = Val_volume (r, connv);
 
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolGetXMLDesc.
  * In generator.pl this function has signature "vol, 0U : string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLGETXMLDESC
-extern char *virStorageVolGetXMLDesc (virStorageVolPtr vol, unsigned  int flags) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_get_xml_desc (value volv)
 {
   CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEVOLGETXMLDESC
-  /* Symbol virStorageVolGetXMLDesc not found at compile time. */
-  not_supported ("virStorageVolGetXMLDesc");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolGetXMLDesc
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolGetXMLDesc);
 
   CAMLlocal1 (rv);
   virStorageVolPtr vol = Volume_val (volv);
@@ -2707,32 +2021,16 @@ ocaml_libvirt_storage_vol_get_xml_desc (value volv)
   rv = caml_copy_string (r);
   free (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolGetPath.
  * In generator.pl this function has signature "vol : string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLGETPATH
-extern char *virStorageVolGetPath (virStorageVolPtr vol) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_get_path (value volv)
 {
   CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEVOLGETPATH
-  /* Symbol virStorageVolGetPath not found at compile time. */
-  not_supported ("virStorageVolGetPath");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolGetPath
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolGetPath);
 
   CAMLlocal1 (rv);
   virStorageVolPtr vol = Volume_val (volv);
@@ -2745,32 +2043,16 @@ ocaml_libvirt_storage_vol_get_path (value volv)
   rv = caml_copy_string (r);
   free (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolGetKey.
  * In generator.pl this function has signature "vol : static string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLGETKEY
-extern const char *virStorageVolGetKey (virStorageVolPtr vol) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_get_key (value volv)
 {
   CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEVOLGETKEY
-  /* Symbol virStorageVolGetKey not found at compile time. */
-  not_supported ("virStorageVolGetKey");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolGetKey
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolGetKey);
 
   CAMLlocal1 (rv);
   virStorageVolPtr vol = Volume_val (volv);
@@ -2782,32 +2064,16 @@ ocaml_libvirt_storage_vol_get_key (value volv)
 
   rv = caml_copy_string (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStorageVolGetName.
  * In generator.pl this function has signature "vol : static string".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEVOLGETNAME
-extern const char *virStorageVolGetName (virStorageVolPtr vol) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_vol_get_name (value volv)
 {
   CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEVOLGETNAME
-  /* Symbol virStorageVolGetName not found at compile time. */
-  not_supported ("virStorageVolGetName");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStorageVolGetName
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStorageVolGetName);
 
   CAMLlocal1 (rv);
   virStorageVolPtr vol = Volume_val (volv);
@@ -2819,32 +2085,16 @@ ocaml_libvirt_storage_vol_get_name (value volv)
 
   rv = caml_copy_string (r);
   CAMLreturn (rv);
-#endif
 }
 
 /* Automatically generated binding for virStoragePoolLookupByVolume.
  * In generator.pl this function has signature "vol : pool from vol".
  */
 
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
-extern virStoragePoolPtr virStoragePoolLookupByVolume (virStorageVolPtr vol) __attribute__((weak));
-#endif
-#endif
-
 CAMLprim value
 ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
 {
   CAMLparam1 (volv);
-#ifndef HAVE_VIRSTORAGEPOOLLOOKUPBYVOLUME
-  /* Symbol virStoragePoolLookupByVolume not found at compile time. */
-  not_supported ("virStoragePoolLookupByVolume");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virStoragePoolLookupByVolume
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virStoragePoolLookupByVolume);
 
   CAMLlocal2 (rv, connv);
   virStorageVolPtr vol = Volume_val (volv);
@@ -2858,158 +2108,6 @@ ocaml_libvirt_storage_pool_lookup_by_volume (value volv)
   rv = Val_pool (r, connv);
 
   CAMLreturn (rv);
-#endif
-}
-
-/* Automatically generated binding for virJobFree.
- * In generator.pl this function has signature "job : free".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRJOBFREE
-extern int virJobFree (virJobPtr job) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_job_free (value jobv)
-{
-  CAMLparam1 (jobv);
-#ifndef HAVE_VIRJOBFREE
-  /* Symbol virJobFree not found at compile time. */
-  not_supported ("virJobFree");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virJobFree
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virJobFree);
-
-  virJobPtr job = Job_val (jobv);
-  virConnectPtr conn = Connect_jobv (jobv);
-  int r;
-
-  NONBLOCKING (r = virJobFree (job));
-  CHECK_ERROR (r == -1, conn, "virJobFree");
-
-  /* So that we don't double-free in the finalizer: */
-  Job_val (jobv) = NULL;
-
-  CAMLreturn (Val_unit);
-#endif
-}
-
-/* Automatically generated binding for virJobCancel.
- * In generator.pl this function has signature "job : unit".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRJOBCANCEL
-extern int virJobCancel (virJobPtr job) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_job_cancel (value jobv)
-{
-  CAMLparam1 (jobv);
-#ifndef HAVE_VIRJOBCANCEL
-  /* Symbol virJobCancel not found at compile time. */
-  not_supported ("virJobCancel");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virJobCancel
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virJobCancel);
-
-  virJobPtr job = Job_val (jobv);
-  virConnectPtr conn = Connect_jobv (jobv);
-  int r;
-
-  NONBLOCKING (r = virJobCancel (job));
-  CHECK_ERROR (r == -1, conn, "virJobCancel");
-
-  CAMLreturn (Val_unit);
-#endif
-}
-
-/* Automatically generated binding for virJobGetNetwork.
- * In generator.pl this function has signature "job : net from job".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRJOBGETNETWORK
-extern virNetworkPtr virJobGetNetwork (virJobPtr job) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_job_get_network (value jobv)
-{
-  CAMLparam1 (jobv);
-#ifndef HAVE_VIRJOBGETNETWORK
-  /* Symbol virJobGetNetwork not found at compile time. */
-  not_supported ("virJobGetNetwork");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virJobGetNetwork
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virJobGetNetwork);
-
-  CAMLlocal2 (rv, connv);
-  virJobPtr job = Job_val (jobv);
-  virConnectPtr conn = Connect_jobv (jobv);
-  virNetworkPtr r;
-
-  NONBLOCKING (r = virJobGetNetwork (job));
-  CHECK_ERROR (!r, conn, "virJobGetNetwork");
-
-  connv = Field (jobv, 1);
-  rv = Val_network (r, connv);
-
-  CAMLreturn (rv);
-#endif
-}
-
-/* Automatically generated binding for virJobGetDomain.
- * In generator.pl this function has signature "job : dom from job".
- */
-
-#ifdef HAVE_WEAK_SYMBOLS
-#ifdef HAVE_VIRJOBGETDOMAIN
-extern virDomainPtr virJobGetDomain (virJobPtr job) __attribute__((weak));
-#endif
-#endif
-
-CAMLprim value
-ocaml_libvirt_job_get_domain (value jobv)
-{
-  CAMLparam1 (jobv);
-#ifndef HAVE_VIRJOBGETDOMAIN
-  /* Symbol virJobGetDomain not found at compile time. */
-  not_supported ("virJobGetDomain");
-  CAMLnoreturn;
-#else
-  /* Check that the symbol virJobGetDomain
-   * is in runtime version of libvirt.
-   */
-  WEAK_SYMBOL_CHECK (virJobGetDomain);
-
-  CAMLlocal2 (rv, connv);
-  virJobPtr job = Job_val (jobv);
-  virConnectPtr conn = Connect_jobv (jobv);
-  virDomainPtr r;
-
-  NONBLOCKING (r = virJobGetDomain (job));
-  CHECK_ERROR (!r, conn, "virJobGetDomain");
-
-  connv = Field (jobv, 1);
-  rv = Val_domain (r, connv);
-
-  CAMLreturn (rv);
-#endif
 }
 
 #include "libvirt_c_epilogue.c"