<div dir="ltr">This explains the <span style="font-size:12.8px">"wrong argument for loadbang method" but not why the method is called twice at patcher loading.</span></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">--<br>do it yourself                       <br><a href="http://antoine.villeret.free.fr" target="_blank">http://antoine.villeret.free.fr</a><br></div></div>
<br><div class="gmail_quote">2017-01-02 17:52 GMT+01:00 Miller Puckette <span dir="ltr"><<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Oh, I see :)<br>
<br>
the "loadbang" method is now called with a floating-point argument, so you<br>
can do this:<br>
<br>
static void loadbang_loadbang(t_loadbang *x, t_floatarg action)<br>
{<br>
    if (action == LB_LOAD)<br>
        outlet_bang(x->x_obj.ob_<wbr>outlet);<br>
}<br>
<br>
and just get the one bang.  This was done to allow "init" and "Close" bangs<br>
as well.<br>
<br>
cheers<br>
<span class="HOEnZb"><font color="#888888">Miller<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, Jan 02, 2017 at 05:34:02PM +0100, Antoine Villeret wrote:<br>
> here is a sample code that demonstrate the issue :<br>
> <a href="https://raw.githubusercontent.com/avilleret/helloworld/loadbang_issue/helloworld.c" rel="noreferrer" target="_blank">https://raw.githubusercontent.<wbr>com/avilleret/helloworld/<wbr>loadbang_issue/helloworld.c</a><br>
><br>
> When the object is created, loadbang method is called.<br>
> Save the patch.<br>
> Close it<br>
> Reopen it, then the loadbang method is called twice (maybe one time at<br>
> object loading and one more at patcher loadbang).<br>
><br>
><br>
><br>
> --<br>
> do it yourself<br>
> <a href="http://antoine.villeret.free.fr" rel="noreferrer" target="_blank">http://antoine.villeret.free.<wbr>fr</a><br>
><br>
> 2017-01-02 17:25 GMT+01:00 Miller Puckette <<a href="mailto:msp@ucsd.edu">msp@ucsd.edu</a>>:<br>
><br>
> > Happy new year to you...<br>
> ><br>
> > I don't get this behavior - can you send a sample patch?<br>
> ><br>
> > thanks<br>
> > Miller<br>
> ><br>
> > On Mon, Jan 02, 2017 at 04:50:47PM +0100, Antoine Villeret wrote:<br>
> > > Hello,<br>
> > ><br>
> > > Happy new year pd-list !<br>
> > ><br>
> > > With pd-0.46-7, loadbang method was called only once when patcher loads.<br>
> > > Now with 0.47-1, loadbang method are now called twice.<br>
> > > Why loadbang method is called twice ?<br>
> > ><br>
> > > As far as I understand, loadbang method could be called not only on<br>
> > patcher<br>
> > > load (LB_LOAD), but also when closing an abstraction (LB_CLOSE) and<br>
> > before<br>
> > > the object is connected to parent patcher (LB_INIT).<br>
> > ><br>
> > > Many externals uses this loadbang method to initiate their state.<br>
> > > This new behavior trig a lots of "wrong argument for loadbang method"<br>
> > error<br>
> > > in pd console.<br>
> > ><br>
> > > Is it a good practice to rely on loadbang call to initiate objects ? or<br>
> > > should we avoid it and use [loadbang] object and/or make initialisation<br>
> > in<br>
> > > object_new method ?<br>
> > > --<br>
> > > do it yourself<br>
> > > <a href="http://antoine.villeret.free.fr" rel="noreferrer" target="_blank">http://antoine.villeret.free.<wbr>fr</a><br>
> ><br>
> > > ______________________________<wbr>_________________<br>
> > > <a href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br>
> > > UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/" rel="noreferrer" target="_blank">https://lists.puredata.info/</a><br>
> > listinfo/pd-list<br>
> ><br>
> ><br>
</div></div></blockquote></div><br></div>