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

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

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

  /* get arguments passed from the Ch function */
  Ch_VaStart(interp, ap, varg);
  arg1 = Ch_VaArg(interp, ap, data_type1);   /* get 1st argument  */

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

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