<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Strange, this is happening with the cyclone/toxy objects too.  I wonder what's causing it...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>.hc</DIV><BR><DIV><DIV>On Jan 9, 2007, at 2:50 PM, ugur guney wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"># Hi list!<BR># I'm trying to learn how to write externals (after being able to link and compile the source codes thanks to Yvan Vander Sanden's tutorial) and come up with a strange behavoir: The object [additive~] turns into a messege box [additive~( (and sometimes its borders are totally erased or sometimes pd crashes) after saving the patch (but not everytime). Maybe I made a mistake that I couldn't find. What might be the reason of such an error? <BR># Here is the code I've written. The object should be post the number of incoming bangs and the time after creation (when dsp is on) and compiled .dll file is attached.<BR>-ugur-<BR><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">#include "m_pd.h"</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">static t_class *additive_tilde_class;</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;"> typedef struct _additive_tilde {</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  t_object x_obj;</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">  t_int bangtime;</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  t_float time;</SPAN><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">} t_additive_tilde;</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;"> void additive_tilde_bang(t_additive_tilde *x)</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">{</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">   post("you banged %d times. time: %f", x-&gt;bangtime++, x-&gt;time);</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">}</SPAN><BR style="font-family: courier new,monospace;"> <BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">t_int *additive_tilde_perform(t_int *w)</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;"> {</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  t_additive_tilde *x = (t_additive_tilde *)(w[1]);</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">   t_sample       *out =         (t_sample *)(w[2]);</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  int               n =                (int)(w[3]);</SPAN><BR style="font-family: courier new,monospace;"> <BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  while (n--)</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  {</SPAN> <BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">    *out++ = x-&gt;time;</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">     x-&gt;time += 1.0f/44100;</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  }</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">  return (w+4);</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">}</SPAN><BR style="font-family: courier new,monospace;"> <BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">void additive_tilde_dsp(t_additive_tilde *x, t_signal **sp)</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;"> {</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  dsp_add(additive_tilde_perform, 3, x,</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">           sp[0]-&gt;s_vec, sp[0]-&gt;s_n);</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">}</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">void *additive_tilde_new(t_floatarg f)</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">{</SPAN><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">  t_additive_tilde *x = (t_additive_tilde *)pd_new(additive_tilde_class);</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">   x-&gt;time = f;</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  x-&gt;bangtime =  0;</SPAN><SPAN style="font-family: courier new,monospace;"></SPAN><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">  outlet_new(&amp;x-&gt;x_obj, gensym("signal")); </SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  return (void *)x;</SPAN><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">}</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">__declspec (dllexport) void additive_tilde_setup(void) </SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">{</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  additive_tilde_class = class_new(gensym("additive~"), </SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">        (t_newmethod)additive_tilde_new,</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">         0, sizeof(t_additive_tilde),</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">        CLASS_DEFAULT,</SPAN><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">         A_DEFFLOAT, 0);</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">  class_addmethod(additive_tilde_class,</SPAN> <BR style="font-family: courier new,monospace;"><SPAN style="font-family: courier new,monospace;">        (t_method)additive_tilde_dsp, gensym("dsp"), 0);</SPAN><BR style="font-family: courier new,monospace;"><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">  class_addbang(additive_tilde_class, additive_tilde_bang);</SPAN><SPAN style="font-family: courier new,monospace;"></SPAN><BR style="font-family: courier new,monospace;"> <SPAN style="font-family: courier new,monospace;">}</SPAN><BR><SPAN><DIV>&lt;additive~.dll&gt;</DIV></SPAN><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="mailto:PD-list@iem.at">PD-list@iem.at</A> mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">UNSUBSCRIBE and account-management -&gt; <A href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV><BR></DIV><DIV>------------------------------------------------------------------------</DIV><DIV><BR></DIV><DIV>As we enjoy great advantages from inventions of others, we should be glad of an opportunity to serve others by any invention of ours; and this we should do freely and generously.         - Benjamin Franklin</DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>