[plt-scheme] Specifying a callback that takes a f64vector

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Apr 30 11:16:40 EDT 2009

On Thu, Apr 30, 2009 at 4:11 PM, Eli Barzilay <eli at barzilay.org> wrote:
>> typedef void (lm_evaluate_ftype) (double *par, int m_dat, double *fvec,
>>                                 void *data, int *info);
> This declaration suffers from the usual header file problem: it
> doesn't specify which values are inputs and which are outputs...

fvec is output; all others are input.

> Which part exactly?  What looks like it's almost definitely wrong is
> that this function returns void, and no other value, so it would be
> pretty useless as defined.  Perhaps you're confusing input and output
> annotations?  (`i' mode is for a vector that is an input to the
> function.)

The typedef is a function pointer that is called by C code. I just
want the function pointer to in turn call Scheme code. So rearranging
parameters to be returned values is not necessary or desirable as this
will break the calling code.


Posted on the users mailing list.