[PD] deconstructors in pd externals

Peter Worth peterworth2 at googlemail.com
Thu Aug 3 14:00:00 CEST 2006


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?

thanks,
pete.




More information about the Pd-list mailing list