<div dir="ltr">On Thu, Oct 12, 2017 at 4:38 AM, IOhannes m zmoelnig <span dir="ltr"><<a href="mailto:zmoelnig@iem.at" target="_blank">zmoelnig@iem.at</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2017-10-11 23:00, Pure Data Computer Music System SVN repository wrote:<br>
> Don't use sys_fopen with MSVC as its FILE struct is not compatible.<br>
<br>
hmm, i'm pretty sure this is the wrong approach.<br>
the sole purpose of sys_fopen() is to help Windows users (as it wraps<br>
the use of non-ascii filenames!). on non-windows platforms sys_fopen()<br>
is basically identical to fopen().<br>
<br>
i guess the problem you are having is hat the FILE handle returned by<br>
_fopen() depends on the libC implementation, and if Pd has been linked<br>
against a different libc implementation than midifile, they might be<br>
"incompatible".<br></blockquote><div> </div><div>Precisely. I have been bitten by that before. <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">e.g. this is the reason why Pd provides a sys_fclose() (since running<br>
flose() on a sys_fopen()ed file would leak ressources).<br>
<br>
since there's a number of externals that are successfully using<br>
sys_fopen()/sys_fclose(), wonder what goes wrong in midifile.<br>
what exactly is meant by "incompatibility"?<br>
<br></blockquote><div><br></div><div>It's only sys_fclose() (and things that use FILE) that doesn't work, calling Pd functions like post() cause no trouble.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
since when does the problem exist? (e.g. did something change in the Pd<br>
build process that triggered that error?)<br>
<br></blockquote><div><br></div><div>Since yesterday I've been trying to build midifile.c for Windows7 using Visual Studio 2017. When I run the resulting dll using midifile-help.pd it crashes Pd (0.48.0 installed from Miller's site) whenever sys_fopen() is called. Doing the same thing using fopen() from stdio.h works fine.<br></div><div><br></div><div>The makefile in Miller's distribution has</div><div>VCSDK = "C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"<br>VC9 = "C:\\Program Files\\Microsoft Visual Studio 9.0\\VC"<br>MSCC = cl<br>MSLN = link<br><br></div>I'm using a different version of the same MS tools and building from the IDE. Possibly the c runtime is not the same? I would have expected a conflict if using MinGW.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Here is some info relevant to the situation, bur I'm not sure what to do with it:<br></div><div class="gmail_quote"><a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/potential-errors-passing-crt-objects-across-dll-boundaries">https://docs.microsoft.com/en-us/cpp/c-runtime-library/potential-errors-passing-crt-objects-across-dll-boundaries</a><br><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
is there some bug-report against Pd about sys_fclose() being unusable on<br>
W32?<br>
<br>
<br>
fgasmr<br>
<span class="gmail-m_-7764038525726707229m_-2098037667262905503m_-7068982336470778439gmail-HOEnZb"><font color="#888888">IOhannes<br>
<br>
</font></span><br>______________________________<wbr>_________________<br>
Pd-dev mailing list<br>
<a href="mailto:Pd-dev@lists.iem.at" target="_blank">Pd-dev@lists.iem.at</a><br>
<a href="https://lists.puredata.info/listinfo/pd-dev" rel="noreferrer" target="_blank">https://lists.puredata.info/li<wbr>stinfo/pd-dev</a><br>
<br></blockquote></div><br></div></div>