Hi,
this is a known issue with recent GCC versions. Just don't compile with "-Werror" or disable the warning with "-Wno-cast-function-type".
Did you enable "-Werror" yourself? Generally, it's not a good idea to enable "-Werror" by default in your build system because new compiler versions tend to introduce new warnings which in turn may break the build process.
Christof
On 17.09.2023 15:33, ub wrote:
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
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list