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

int ptfun2_1() {
  printf("ptfun2_1() in ptfun2.ch is called \n");
  return 10;
}

int ptfun2_2() {
  printf("ptfun2_2() in ptfun2.ch is called \n");
  return 20;
}

int main() {
  int id;
  funcHandle  handle;

  /* set function handle */
  ptfun2_setHandle(1, ptfun2_1);
  ptfun2_setHandle(2, ptfun2_2);

  /* get function handle */
  handle = ptfun2_getHandle(1);
  printf("retval of id1 = %d\n", handle());
  handle  = ptfun2_getHandle(2);
  printf("retval of id2 = %d\n", handle());

  ptfun2_setHandle(2, ptfun2_1);
  printf("retval of id2 = %d\n", ptfun2_getHandle(2)());

  return 0;
}
