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

EXPORTCH void chcallfuncbyname_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;
  void *chfunhandle;
  int funret;
  double d;

  Ch_VaStart(interp, ap, varg); 
  /* call Ch function by its name */
  Ch_CallFuncByName(interp, "chfun", &funret, 20);
  printf("The return value in C space from Ch function chfun(20) is %d\n", funret); 
  /* call Ch function in function file */
  Ch_CallFuncByName(interp, "hypot", &d, 3.0, 4.0);
  printf("The return value in C space from Ch function hypot(3,4) is %f\n", d);
  Ch_VaEnd(interp, ap);
  return;
}
