/* 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;

  int array_dim1, array_dim2;
  data_type1 arg1;
  data_type2 arg2;
  return_type *pretval;

  /* get arguments including address and dimentions of 
     array passed from the Ch address space */
  Ch_VaStart(interp, ap, varg);
  /* get address of the returned array in Ch */
  pretval = Ch_VaArg(interp, ap, return_type*); 
  array_dim1 = Ch_VaArg(interp, ap, int); /* get 1st dimention */
  array_dim2 = Ch_VaArg(interp, ap, int);  /* get 2nd dimention */
  arg1 = Ch_VaArg(interp, ap, data_type1); /* get 1st other argument */
  arg2 = Ch_VaArg(interp, ap, data_type2); /* get 2nd other argument */

  /*
      ...
      here is code to do computational jobs
      and put result into memory pointed to by pretval
  */

  Ch_VaEnd(interp, ap);
}
