<div dir="ltr"><div dir="ltr"><div dir="ltr">Hello all, <div><br></div><div>I've been working on trying to send data between different externals, but I'm not doing something quite right. I've looked at the code in d_global.c as well as for send and receive.</div><div>The only difference I can see is that mine is not all in the same .c file while in the pd source it is.</div><div><br></div><div>Here's the external with the data. Just an int for now, but it will be holding a binary tree later.</div><div><br></div>static t_class *send_test_class;<br>typedef struct _send_test {</div><div dir="ltr">   t_object  x_obj;<br>   t_symbol* name;<br>   int value;<br>}t_send_test;<br><br>static void *send_test_new(t_symbol *s, t_floatarg f) {<br>   t_send_test *x = (t_send_test *)pd_new(send_test_class);</div><div dir="ltr">   x->name = s;</div><div dir="ltr">   x->value = f;<br>   pd_bind(&x->x_obj.ob_pd, s); // bind to the name we're given</div><div dir="ltr">   post("send_test created with name %s, and value %d", x->name->s_name, x->value);</div><div dir="ltr">   return(x);<br>}<br><br></div><div dir="ltr">static void send_test_free(t_send_test *x) {</div><div dir="ltr">   pd_unbind(&x->x_obj.ob_pd, x->name); // unbind when deleted<br>}<br><br>void send_test_setup(void) {<br>   send_test_class = class_new(gensym("send_test"),</div><div dir="ltr">                                 (t_newmethod)send_test_new,<br>                                 (t_method)send_test_free,<br>                                 sizeof(t_send_test),<br>                                 CLASS_NOINLET,<br>                                 A_DEFSYM,<br>                                 A_DEFFLOAT,<br>                                 0);</div><div dir="ltr">}</div><div dir="ltr"><br></div><div dir="ltr">And here's the receiver.<br><div><br></div><div>static t_class *send_test_class;<br></div><div><p style="margin:0px;font-stretch:normal;line-height:normal">static t_class *rcv_test_class;<br><br>typedef struct _send_test {<br>   t_object  x_obj;<br>   t_symbol* name;<br>   int value;<br>}t_send_test;<br><br>typedef struct _rcv_test {<br>   t_object  x_obj;<br>   t_symbol* name;</p><p style="margin:0px;font-stretch:normal;line-height:normal">   int value;<br>} t_rcv_test;<br><br>static void *rcv_test_new(t_symbol *s) {<br>   t_rcv_test *x = (t_rcv_test *)pd_new(rcv_test_class);<br>   x->name = s;<br>   t_send_test* sender = (t_send_test*)pd_findbyclass(x->name, send_test_class);<br><br>    x->value = sender->value;<br>    post("sender value is %d", sender->value);<br>    post("rcv_test created with name %s, and value %d", x->name->s_name, x->value);<br>    return(x);<br>}<br><br>static void rcv_test_free(t_rcv_test *x) {}<br><br>void rcv_test_setup(void) {<br>   rcv_test_class = class_new(gensym("rcv_test"),<br>                                               (t_newmethod)rcv_test_new,<br>                                               (t_method)rcv_test_free,<br>                                                sizeof(t_rcv_test),<br>                                                CLASS_NOINLET,<br>                                                A_DEFSYM,</p><p style="margin:0px;font-stretch:normal;line-height:normal">                                                0);<br>}</p></div><div><br></div><div>What exactly is it that I'm doing wrong?</div></div></div></div>