[PD-dev] usages of 't_gotfn'
Michael McGonagle
fndsnd at rcnchicago.com
Sat May 17 01:04:28 CEST 2003
Hello all,
I have a single function (lyapunov) that I need to be able to use across
several different externals, each with a different object struct. I am
not really sure if this is the correct way to implement this, but my
function (lyapunov) needs to be able to call a function within the
externals. So, in doing this, I have created the following prototype for
my function:
double lyapunov(void *frac, t_gotfn calc, int v_cnt, double *vars);
'frac' is a pointer to the external object that is calling 'lyapunov',
this will be passed to the 'calc' callback. Basically, code for this
looks like:
calc(frac);
Pretty basic. I originally was trying to use 't_method' for the type of
'calc', but the compiler kept complaining that the number of arguments
passed to the callback was incorrect. So, now with the type of
't_gotfn', everything compiles and appears to run as expected.
So, my question: Is there a more appropriate way of doing this? Also, is
there a potential problem with portability of this technique? I am on
Mac OS X, but these externals need to run "EVERYWHERE"!
Thanks,
Mike
More information about the Pd-dev
mailing list