#include <stdio.h>

extern "C" int init(char *const*x)
{
 fprintf(stderr, "Init");
 while(*x) {
	fprintf(stderr, "\t%s\n", *x);
	x++;
	}
 return 4;
}

extern "C" int done() { fprintf(stderr, "Done\n"); return 4;}

extern "C" double chisq(char *const*arg, const double *p, int n)
{
 printf("dlltest.c: n=%d; call=%s\n", n, *arg&&**arg ? *arg : "<nil>");
 int i;
 double sum = 0;
 for(i=0; i<n; i++)
	sum += (i+1)*p[i]*p[i];
 return sum;
}
