void g(void* user_data, double t, double const *x, double *g) {
const struct interface_data* data = ((struct interface_data*)user_data);
static long count = 0;
count++;
/* Wrap the values in fresh big arrays */
value ml_t = caml_copy_double(t);
value ml_x = caml_ba_alloc_dims(CAML_BA_FLOAT64 | CAML_BA_C_LAYOUT, 1,
(double*)x, data->qs->n);
value ml_g = caml_ba_alloc_dims(CAML_BA_FLOAT64 | CAML_BA_C_LAYOUT, 1,
g, data->qs->mc);
/* call the OCaml callback */
caml_callback3(data->g, ml_t, ml_x, ml_g);
}
Is there anything obvious, I am doing wrong?