<div dir="ltr">Extended on MinGW and my libpd project on MinGW show the same problem, that makes sense. Thanks, Martin! <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 5, 2014 at 10:49 AM, Martin Peach <span dir="ltr">&lt;<a href="mailto:martin.peach@sympatico.ca" target="_blank">martin.peach@sympatico.ca</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think vanilla is compiled with MSVC and extended with MinGW so there are incompatibilities in the c runtime especially where file pointers are concerned. Sometimes externals will work on both versions but if the external opens its own files using Pd functions to find the path then it probably won&#39;t.<br>


<br>
Martin<div class=""><br>
<br>
On 2014-04-05 11:36, Rafael Vega wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
I also find it strange that using the external on pd-vanilla by copying<br>
the dll to the &quot;extra&quot; folder in the vanilla directory works fine. Any<br>
ideas why? Maybe has something to do with compiler environment<br>
differences between vanilla and extended? Do you guys use MinGW for both?<br>
<br>
<br>
<br>
On Sat, Apr 5, 2014 at 10:34 AM, Rafael Vega &lt;<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a><br></div><div class="">
&lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;&gt; wrote:<br>
<br>
    Hi Miller,<br>
<br>
    On my windows machines (XP and 8.1), if I tried to open with mode<br>
    &#39;r&#39;, the later call to ov_open would fail. If I change the mode to<br>
    &#39;rb&#39;, the later call to ov_open works fine. I also read somewhere<br>
    that the &#39;b&#39; mode does nothing on Unix (I still have to test that<br>
    when I&#39;m back to my Linux and Mac machines).<br>
<br>
    As for the comparison against NULL, the original code was comparing<br>
<br>
    if((x-&gt;x_file = sys_fopen(filename-&gt;s_name, &quot;r&quot;)) &lt; 0)<br>
<br>
    And I changed it to  &lt;=  instead. You are right in that it makes no<br>
    sense to compare the sign of a pointer so  ==  it is :)<br>
<br>
    R.<br>
<br>
<br>
<br>
    On Sat, Apr 5, 2014 at 9:03 AM, Miller Puckette &lt;<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a><br></div><div class="">
    &lt;mailto:<a href="mailto:msp@ucsd.edu" target="_blank">msp@ucsd.edu</a>&gt;&gt; wrote:<br>
<br>
        I THink it should really be:<br>
<br>
        if((x-&gt;x_file = sys_fopen(filename-&gt;s_name, &quot;r&quot;)) == 0)<br>
<br>
        sys_fopen returns NULL (also known as 0) on failure, otherwise a<br>
        pointer;<br>
        it makes no sense to check the sign of a pointer as far as I know.<br>
<br>
        cheers<br>
        Miller<br>
<br>
        On Fri, Apr 04, 2014 at 11:21:37PM -0400, Martin Peach wrote:<br>
         &gt; I think it&#39;s here:<br>
         &gt;<br>
         &gt; <a href="http://sourceforge.net/p/pure-data/patches/" target="_blank">http://sourceforge.net/p/pure-<u></u>data/patches/</a><br>
         &gt;<br>
         &gt; Martin<br>
         &gt;<br>
         &gt; On 2014-04-04 21:49, Rafael Vega wrote:<br>
         &gt; &gt;Even more stuff ;)<br>
         &gt; &gt;<br>
         &gt; &gt;In the same file, oggread~.c there is a line that reads:<br>
         &gt; &gt;<br>
         &gt; &gt;     if((x-&gt;x_file = sys_fopen(filename-&gt;s_name, &quot;r&quot;)) &lt; 0)<br>
         &gt; &gt;<br>
         &gt; &gt;But it should be:<br>
         &gt; &gt;<br>
         &gt; &gt;     if((x-&gt;x_file = sys_fopen(filename-&gt;s_name, &quot;rb&quot;)) &lt;= 0)<br>
         &gt; &gt;<br>
         &gt; &gt;Now, to figure out how to submit a patch to pd-extended :P<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;On Fri, Apr 4, 2014 at 7:22 PM, Rafael Vega<br>
        &lt;<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br></div>
         &gt; &gt;&lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;&gt;<u></u>&gt;<div>

<div class="h5"><br>
        wrote:<br>
         &gt; &gt;<br>
         &gt; &gt;    Follow up:<br>
         &gt; &gt;<br>
         &gt; &gt;    Looking at the code for oggread~, I found that it does<br>
        the actual<br>
         &gt; &gt;    opening of the file with<br>
         &gt; &gt;<br>
         &gt; &gt;         if(ov_open(x-&gt;x_file, &amp;x-&gt;x_ov, NULL, -1) &lt; 0)<br>
         &gt; &gt;<br>
         &gt; &gt;    on the ov_open documentation it warns windows<br>
        programmers not to use<br>
         &gt; &gt;    ov_open but ov_open_callbacks instead [1] and [2] so I<br>
        changed that<br>
         &gt; &gt;    line to the following and I&#39;m getting the message<br>
        &quot;Bitstream does<br>
         &gt; &gt;    not contain any Vorbis data&quot;. I&#39;m pretty sure my file is<br>
        a valid ogg<br>
         &gt; &gt;    file. I created it using audacity and also tried with an<br>
        ogg file<br>
         &gt; &gt;    downloaded from <a href="http://freesound.org" target="_blank">freesound.org</a> &lt;<a href="http://freesound.org" target="_blank">http://freesound.org</a>&gt;<br>
        &lt;<a href="http://freesound.org" target="_blank">http://freesound.org</a>&gt;.<br>
         &gt; &gt;<br>
         &gt; &gt;    Any help with this will be very much appreciated<br>
         &gt; &gt;<br>
         &gt; &gt;    :)<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;             int ret = ov_open_callbacks(x-&gt;x_file,<br>
        &amp;x-&gt;x_ov, NULL, -1,<br>
         &gt; &gt;    OV_CALLBACKS_DEFAULT);<br>
         &gt; &gt;             switch(ret){<br>
         &gt; &gt;                 case OV_EREAD:<br>
         &gt; &gt;                      post(&quot;A read from media returned an<br>
        error.&quot;);<br>
         &gt; &gt;                      break;<br>
         &gt; &gt;                 case OV_ENOTVORBIS:<br>
         &gt; &gt;                     post(&quot;Bitstream does not contain any<br>
        Vorbis data&quot;);<br>
         &gt; &gt;                     break;<br>
         &gt; &gt;                 case OV_EVERSION:<br>
         &gt; &gt;                     post(&quot;OV_EVERSION - Vorbis version<br>
        mismatch.&quot;);<br>
         &gt; &gt;                     break;<br>
         &gt; &gt;                 case OV_EBADHEADER:<br>
         &gt; &gt;                     post(&quot;Invalid Vorbis bitstream header.&quot;);<br>
         &gt; &gt;                     break;<br>
         &gt; &gt;                 case OV_EFAULT:<br>
         &gt; &gt;                     post(&quot;Internal logic fault; indicates a<br>
        bug or<br>
         &gt; &gt;    heap/stack corruption.&quot;);<br>
         &gt; &gt;                     break;<br>
         &gt; &gt;             }<br>
         &gt; &gt;             if(ret &lt;0)<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;    links:<br>
         &gt; &gt;<br>
         &gt; &gt;    [1]<br>
        <a href="http://xiph.org/vorbis/doc/vorbisfile/ov_open_callbacks.html" target="_blank">http://xiph.org/vorbis/doc/<u></u>vorbisfile/ov_open_callbacks.<u></u>html</a><br>
         &gt; &gt;    [2] <a href="http://xiph.org/vorbis/doc/vorbisfile/ov_open.html" target="_blank">http://xiph.org/vorbis/doc/<u></u>vorbisfile/ov_open.html</a><br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;    On Fri, Apr 4, 2014 at 5:48 PM, Rafael Vega<br>
        &lt;<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br></div></div>
         &gt; &gt;    &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a><div><div class="h5"><br>
        &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;&gt;<u></u>&gt; wrote:<br>
         &gt; &gt;<br>
         &gt; &gt;        Hi.<br>
         &gt; &gt;<br>
         &gt; &gt;        I am trying to use [oggread~] external on an<br>
        application i&#39;m<br>
         &gt; &gt;        developing with libpd. No problems on mac or linux.<br>
        Howerver, on<br>
         &gt; &gt;        windows (xp and 8, 32bit) I keep getting an error<br>
        message from<br>
         &gt; &gt;        oggread~ when I try to open an ogg file. Even<br>
        ogg_read~-help.pd<br>
         &gt; &gt;        won&#39;t work:<br>
         &gt; &gt;<br>
         &gt; &gt;        oggread~: file &quot;C:/Users/rv/any.ogg&quot; opened<br>
         &gt; &gt;        oggread~: error: could not open<br>
        &quot;C:/Users/rv/Desktop/any.ogg&quot; as<br>
         &gt; &gt;        an OggVorbis file<br>
         &gt; &gt;        oggread~: file closed due to error<br>
         &gt; &gt;<br>
         &gt; &gt;        I have tried pd-extended (both installer and<br>
        standalone) and I<br>
         &gt; &gt;        also compiled oggread~ into my application and<br>
        loaded it with<br>
         &gt; &gt;        libpd, same outcome.<br>
         &gt; &gt;<br>
         &gt; &gt;        The weirdest part is that if I run pd vanilla, copy<br>
        oggread~.dll<br>
         &gt; &gt;        from pd-extended into the &quot;extra&quot; directory, the ogg<br>
        files are<br>
         &gt; &gt;        opened correctly.<br>
         &gt; &gt;<br>
         &gt; &gt;        Any ideas on how to make this work? What kind of<br>
        debug info can<br>
         &gt; &gt;        I provide?<br>
         &gt; &gt;<br>
         &gt; &gt;        --<br>
         &gt; &gt;        Rafael Vega<br>
         &gt; &gt; <a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br></div></div>
        &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;&gt;<div class=""><br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;    --<br>
         &gt; &gt;    Rafael Vega<br>
         &gt; &gt; <a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br></div>
        &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;&gt;<div class=""><br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;--<br>
         &gt; &gt;Rafael Vega<br>
         &gt; &gt;<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br></div>
        &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;&gt;<br>
         &gt; &gt;<br>
         &gt; &gt;<br>
         &gt; &gt;_____________________________<u></u>__________________<br>
         &gt; &gt;Pd-dev mailing list<br>
         &gt; &gt;<a href="mailto:Pd-dev@iem.at" target="_blank">Pd-dev@iem.at</a> &lt;mailto:<a href="mailto:Pd-dev@iem.at" target="_blank">Pd-dev@iem.at</a>&gt;<div class=""><br>
         &gt; &gt;<a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-dev</a><br>
         &gt; &gt;<br>
         &gt;<br>
         &gt;<br>
         &gt; ______________________________<u></u>_________________<br>
         &gt; Pd-dev mailing list<br></div>
         &gt; <a href="mailto:Pd-dev@iem.at" target="_blank">Pd-dev@iem.at</a> &lt;mailto:<a href="mailto:Pd-dev@iem.at" target="_blank">Pd-dev@iem.at</a>&gt;<div class=""><br>
         &gt; <a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-dev</a><br>
<br>
<br>
<br>
<br>
    --<br>
    Rafael Vega<br></div><div class="">
    <a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br>
<br>
<br>
<br>
<br>
--<br>
Rafael Vega<br>
<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a> &lt;mailto:<a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a>&gt;<br>
</div></blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Rafael Vega<br></div><a href="mailto:email.rafa@gmail.com" target="_blank">email.rafa@gmail.com</a></div>
</div>