[PD-dev] getting the classname in an class

Hans-Christoph Steiner hans at eds.org
Sat Oct 27 07:48:39 CEST 2007


On Oct 26, 2007, at 8:20 PM, Mathieu Bouchard wrote:

> On Fri, 26 Oct 2007, Hans-Christoph Steiner wrote:
>
>>   binbuf_addv(b, "ssiisiiss", gensym("#X"),gensym("obj"),
>>               x->x_obj.te_xpix, x->x_obj.te_ypix, pd_class(&z- 
>> >g_pd)->c_name,
>>               x->x_width, x->x_height, x->x_bgcolour, x->x_fgcolour);
>>
>>   entry.c:504: error: dereferencing pointer to incomplete type
>
> Oh yeah, you need to #include "m_imp.h" or something, sorry.
>
> Because, in m_pd.h, only the existence of t_class is mentioned, not  
> the content definition of t_class.

Duh... thanks.  It now compiles and runs, but sadly, this doesn't work:

     binbuf_addv(b, "ssiisiiss", gensym("#X"),gensym("obj"),
                 x->x_obj.te_xpix, x->x_obj.te_ypix,
                  pd_class(&z->g_pd)->c_name,
                 x->x_width, x->x_height, x->x_bgcolour, x->x_fgcolour);

I stuck this in entry_new() also

     post("new objectclass: %s", (*(t_pd *)x)->c_name->s_name);


Both of them returned "entry" as the class, even when I loaded with a  
namespace prefix.

.hc



------------------------------------------------------------------------ 
----

All mankind is of one author, and is one volume; when one man dies,  
one chapter is not torn out of the book, but translated into a better  
language; and every chapter must be so translated.... -John Donne






More information about the Pd-dev mailing list