<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>Hey,</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think Günter didn't want to depend on non-public headers like g_canvas.h, so included the glist struct from that header.  Personally, I think makes more sense to include the g_canvas.h header.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>[parentdollarzero] like a useful object, I am not usre what [getdollarzero] does beyond [float $0] or [$0].  Anyway, hopefully they make into Pd-extended.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>.hc</DIV><DIV><BR class="khtml-block-placeholder"></DIV><BR><DIV><DIV>On Aug 27, 2007, at 4:43 PM, Thomas O Fredericks wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Thanks to Han's help page (<A href="http://puredata.info/docs/developer/mingw" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://puredata.info/docs/developer/mingw</A>) I was able to compile a test external on windows with mingw. <BR><BR>I then started making a new external called getdollarzero based on getdir (from ggee) and parentdollarzero (from iemlib2). I compiled it and it works but I had to: <BR>1) remove Guenter's hack from getdir's source code<BR>2) and therefore include g_canvas.h<BR><BR>My question is the following: why is there a hack in the first place? If I do not use it will my code crash PD in some way (I compiled against PD 0.4 and worked fine during testing)?<BR><BR>As a reference, here is my code with the hack commented out :<BR><BR><BR>--------- getdollarzero  --------<BR clear="all"><BR>#include "m_pd.h"<BR>#include "g_canvas.h" //needed to include g_canvas.h once the hack was commented out <BR><BR><BR>/* HACK<BR>struct _glist<BR>{<BR>    t_object gl_obj;            // header in case we're a glist<BR>    t_gobj *gl_list;            // the actual data<BR>    struct _gstub *gl_stub;     // safe pointer handler <BR>    int gl_valid;               // incremented when pointers might be stale<BR>    struct _glist *gl_owner;    // parent glist, supercanvas, or 0 if none<BR>};<BR><BR>END HACK<BR>*/<BR><BR>typedef struct getdollarzero <BR>{<BR>    t_object x_ob;<BR>    t_canvas * x_canvas;<BR>    t_outlet* x_outlet;<BR>    int x_level;<BR>} t_getdollarzero;<BR><BR><BR><BR><BR>static void getdollarzero_bang(t_getdollarzero *x)<BR>{<BR>    int i = x-&gt;x_level; <BR>    t_canvas* last = x-&gt;x_canvas;<BR><BR>    while (i&gt;0) {<BR>        i--;<BR>        if (last-&gt;gl_owner) last = last-&gt;gl_owner;<BR>    }<BR>    // code example taken from iemlib2's parentdollarzero:<BR>     // x-&gt;s_parent_unique = canvas_realizedollar((t_canvas *)this_canvas-&gt;gl_owner, gensym("$0")); <BR>    // original get dir function:<BR>    //outlet_symbol(x-&gt;x_outlet,canvas_getdir(last));<BR><BR>    outlet_symbol(x-&gt;x_outlet,canvas_realizedollar(last, gensym("$0"))); <BR>}<BR><BR>t_class *getdollarzero_class;<BR><BR>static void *getdollarzero_new(t_floatarg level)<BR>{<BR>    t_getdollarzero *x = (t_getdollarzero *)pd_new(getdollarzero_class);<BR>    x-&gt;x_canvas =  canvas_getcurrent(); <BR>    x-&gt;x_outlet =  outlet_new(&amp;x-&gt;x_ob, &amp;s_);<BR>    x-&gt;x_level  =  level;<BR>    return (void *)x;<BR>}<BR><BR>void getdollarzero_setup(void)<BR>{<BR>    getdollarzero_class = class_new(gensym("getdollarzero"), (t_newmethod)getdollarzero_new, 0, <BR>        sizeof(t_getdollarzero), 0, A_DEFFLOAT,0);<BR>    class_addbang(getdollarzero_class, getdollarzero_bang);<BR>}<BR><BR>--------- getdollarzero  end --------<BR clear="all"><BR>-- <BR>thomas ouellet fredericks, <A href="mailto:tof@danslchamp.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">tof@danslchamp.org</A>, montreal, canada<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; "><BR class="Apple-interchange-newline"><DIV><BR></DIV><DIV>----------------------------------------------------------------------------</DIV><DIV><BR></DIV><DIV>Computer science is no more related to the computer than astronomy is related to the telescope.      -Edsger Dykstra</DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>