[PD-dev] calling a function

nosehair911 at bellsouth.net nosehair911 at bellsouth.net
Fri Jun 15 18:57:21 CEST 2007


I'm having problems calling functions and I'm currious if I a doing it the right way.  I a writing the 
external in c++.  I make a class Test and I declare a function for example:

void Test::post_filepath(char* path) {post( "opening %s", path);}

Then within the externals typedef stucture I include a pointer to the class for example:

typedef struct _myexternal {
  t_object  x_obj;
  Test *funct;
} t_myexternal;

When I call the function like this:

void capture_cap(t_myexternal *x, t_symbol *file) {x->funct->post_filepath(file->s_name);}

Pd crashes, I have to do it like this to avoid a crash:

void capture_cap(t_myexternal *x, t_symbol *file) {post( "opening %s", file->s_name);}

what am I doing wrong and what is the proper way to do it?
Thanks,
Alain





More information about the Pd-dev mailing list