
#include <stdio.h>
#include <dlfcn.h>

static void (*cfunc) (const char *);

int
b (const char *caller)
{
   void *handle;

   printf ("function b called from %s\n", caller);

   handle = dlopen ("./c.so", RTLD_LAZY);

   if (!handle)
     return 1;

   cfunc = dlsym (handle, "c");

   if (cfunc)
     cfunc("b");
   else
     return 1;

   return 0;
}
