Hans-Christoph Steiner wrote:
Ok, I've seen a number of different ideas for how to get the complete classname an object was instantiated with from within that class, but I haven't been able to get one working.
Krzysztof did this in externals/miXed/cyclone/hammer/universal.c:
t_gobj *g; for (g = glist->gl_list; g; g = g->g_next)
if (pd_class(&g->g_pd)->c_name == cname) /* LATER rethink */ pd_bang(&g->g_pd);
I tried this in my code, but got an error:
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
I think it's because pd_class just dereferences a pointer and a t_class is just a pointer to an unspecified struct. You need to specify what kind of class you're pointing at.
I think IOhannes recommended this, but I get the same error:
binbuf_addv(b, "ssiisiiss", gensym("#X"),gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix, (*(t_pd *)x)-
c_name->s_name,
x->x_width, x->x_height, x->x_bgcolour, x->x_fgcolour); entry.c:504: error: dereferencing pointer to incomplete type
Again, x is just a pointer to a struct but the compiler doesn't know which kind of struct.
Any suggestions?
Specify the class type that x points to.
Martin