#include #include #include #include #include int main () { void *dl = dlopen (NULL, RTLD_LAZY); if (!dl) { fprintf (stderr, "dlopen: %s\n", dlerror ()); exit (1); } int has_dd = dlsym (dl, "guestfs_dd") != NULL; dlclose (dl); if (!has_dd) printf ("this libguestfs.so does NOT have guestfs_dd function\n"); else { printf ("this libguestfs.so has guestfs_dd function\n"); // Now it's safe to call guestfs_dd (g, "foo", "bar"); } exit (0); }