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

EXPORTCH return_type functionName_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;

  data_type1 arg1;
  data_type2 arg2;
  return_type retval;

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

  /* call the function in Source Library files */
  retval = functionName(arg1, arg2);

  Ch_VaEnd(interp, ap);
  return retval; /* pass the return value to Ch function */
}
