[PD] pd external build problem

ub ub at xdv.org
Sun Sep 17 15:33:59 CEST 2023


hey list,


i was trying to compile a pd-external which i made some time ago and 
found that gcc issues a warning – turned into an error – regarding the 
type of t_newmethod.

  error: cast between incompatible function types from ‘void * 
(*)(t_symbol *, int,  t_atom *)’ {aka ‘void * (*)(struct _symbol *, 
int,  struct _atom *)’} to ‘void * (*)(void)’ [-Werror=cast-function-type]
   478 |          (t_newmethod) zmq_new,

now i checked with the external howto on github and couldn't find 
anything wrong with the code.

the way i understand it, the type should be void * (*)(void) if i would 
not declare an inlet. since i do declare inlets with A_GIMME, it is my 
understanding that the function type of t_newmethod should be void * 
(*)(t_symbol *, int,  t_atom *)

the external loads and seems to run fine, when built without -Werror.

maybe someone can help me fix this.


my class constructor is declared as:

static void *zmq_new(t_symbol *s, int argc, t_atom *argv)


and it's called in class_new like this:

      zmq_class = class_new(gensym("zmq"),
            (t_newmethod) zmq_new,
            (t_method) zmq_destroy,
            sizeof(t_zmq),
            CLASS_DEFAULT, A_GIMME, 0);


the entire code is available at:

https://github.com/sansculotte/pd-zmq


thanks a lot,

ub




More information about the Pd-list mailing list