Peter Worth wrote:
hi,
i'm writing an external that requires a lot of memory freeing when it is destroyed, but i cant find much in the way of documentation telling me how to set up a deconstructor.
at the moment i'm doing this:
extern "C" __declspec( dllexport ) void markovchain_tilde_setup(void) { markovchain_tilde_class = class_new(gensym("markovchain~"), (t_newmethod)markovchain_tilde_new, (t_method)markovchain_tilde_destroy, sizeof(t_markovchain_tilde), CLASS_DEFAULT, A_GIMME, 0); class_addmethod(markovchain_tilde_class, (t_method)markovchain_tilde_dsp, gensym("dsp"), 0); }
with a deconstructor like this:
void *markovchain_tilde_destroy() { ....
but obviously this is no good because i need access to the dataspace struct. so how do i pass a reference to the struct to the deconstructor?
Declare the deconstructor as void markovchain_tilde_destroy(t_markovchain_tilde *x) and keep pointer(s) to the disposable memory somewhere in x. Martin
thanks, pete.
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list