/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include<ch.h>
...
EXPORTCH void functionName_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;
  return_type *pretval;
  data_type1 arg1;
  data_type2 arg2;

  /* get arguments passed from the Ch address space */
  Ch_VaStart(interp, ap, varg);
  pretval = Ch_VaArg(interp, ap, retrun_type*); /* address of the array in Ch space */
  arg1 = Ch_VaArg(interp, ap, data_type1);     /* get 1st argument  */
  arg2 = Ch_VaArg(interp, ap, data_type2);     /* get 2nd argument  */
  /* 
      ... 
      here is code to do computational jobs 
      and copy result into memory pointed to by pretval 
  */
  Ch_VaEnd(interp, ap);
}
