[PD-dev] calling a function

Thomas Grill gr at grrrr.org
Sat Jun 16 15:15:28 CEST 2007


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 at bellsouth.net>  
<nosehair911 at 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 at iem.at
> http://lists.puredata.info/listinfo/pd-dev
>
>





More information about the Pd-dev mailing list