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
Hi Alain, are you sure that funct indeed points to an instance of your class? In other words, have you done something like x->funct = new Test; before?
greetings, Thomas
Am 15.06.2007 um 18:57 schrieb nosehair911@bellsouth.net nosehair911@bellsouth.net:
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
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev