/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include <dlfcn.h>
int diff_arg(int arg1, int (*pf)()) {
  void *dlhandle, *fptr;
  int retval;

  dlhandle = dlopen("libdiffarg.dl", RTLD_LAZY);
  if(dlhandle == NULL) {
    printf("Error: %s(): dlopen(): %s\n", __func__, dlerror());
    return -1;
  }

  fptr = dlsym(dlhandle, "diff_arg_chdl");
  if(fptr == NULL)  {
     printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
     return -1;
  }

  dlrunfun(fptr, &retval, diff_arg, arg1, pf);

  if(dlclose(dlhandle)!=0) {
    printf("Error: %s(): dlclose(): %s\n", __func__, dlerror());
    return -1;
  }
  return retval;
}
