/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include <dlfcn.h> 

int ptfun5_setHandle(funcHandle funptr)  { 
  void *fptr;
  int retval;

  /* dl is loaded in ptfun5.h */
  fptr = dlsym(_Chptfun_handle, "ptfun5_setHandle_chdl");
  if(fptr == NULL)  {
     printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
     return -1;
  }

  dlrunfun(fptr, &retval, ptfun5_setHandle, funptr);
  return retval;
}

funcHandle ptfun5_getHandle(int i)  {
  void *fptr;
  funcHandle retval;

  fptr = dlsym(_Chptfun_handle, "ptfun5_getHandle_chdl");
  if(fptr == NULL)  {
     printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
     return NULL;
  }

  dlrunfun(fptr, &retval, ptfun5_getHandle, i);
  return retval;
}

void ptfun5_call_it()  {
  void *fptr;

  fptr = dlsym(_Chptfun_handle, "ptfun5_call_it_chdl");
  if(fptr == NULL)  {
     printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
     return;
  }

  dlrunfun(fptr, NULL, ptfun5_call_it);
  return;
}

