/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/*******************************************************/
/* following part is added for getting function handle */

EXPORTCH funcHandle getFunction2_chdl(void *varg) {
  ChVaList_t ap;

  data_type1 arg1;
  funcHandle  retval_c = NULL, retval_ch = NULL;

  Ch_VaStart(interp, ap, varg);
  arg1 = Ch_VaArg(interp, ap, data_type1);   /* get 1st argument  */

  /* get the C function pointer which is set by setFunction2_chdl() */
  retval_c = getFunction2(arg1);

  /* replace the C pointer with the Ch one */
  if(retval_c == setFunction2_chdl_funarg) { /* check the consistency */
    retval_ch = (funcHandle)setFunction2_chdl_funptr;
  }
  
  Ch_VaEnd(interp, ap);
  return retval_ch;
}
