<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Did you compile SDL and PhysFS yourself? It could be that the libraries were built with different runtimes (that is, I'm aware of, one of the common linking-runtime crash issues with MSVC).</div><div><br></div><div>Ralph</div><br><div><div>On 1 Nov 2012, at 14:11, Thomas Lokshall &lt;<a href="mailto:thomas.lokshall@gmail.com">thomas.lokshall@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family:arial,sans-serif;font-size:13px">I'm attempting to integrate PhysFS with SDL 2.0 (latest from mercurial) and there seems to be a conflict here.</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">PhysFS 2.0.3 compiles and runs fine with the test program using Visual Studio 10.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div>
<div style="font-family:arial,sans-serif;font-size:13px">However, as soon as you introduce SDL to the equation, it causes crashes. It compiles fine with no errors.</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">I made a skeleton program to test this:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
/* BEGIN */</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>#include &lt;stdio.h&gt;</div><div>#include &lt;physfs.h&gt;</div><div><br>
</div><div>int main(int argc, char *argv[])</div><div>{</div><div>&nbsp; PHYSFS_init(argv[0]);</div><div>&nbsp; getchar();</div><div>&nbsp; PHYSFS_deinit();</div><div>&nbsp; return 0;</div><div>}</div></div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">/* END */</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">This program works just fine. However, if you link with SDL and SDLmain and change the code to this:</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><div>/* BEGIN */</div><div><br></div><div><div>#include &lt;stdio.h&gt;</div><div>#include &lt;physfs.h&gt;</div>
<div>#include &lt;SDL/SDL.h&gt;</div><div><br></div><div>int main(int argc, char *argv[])</div><div>{</div><div>&nbsp; SDL_Init(SDL_INIT_EVERYTHING);</div><div>&nbsp; PHYSFS_init(argv[0]);</div><div>&nbsp; getchar();</div><div>&nbsp; PHYSFS_deinit();</div>
<div>&nbsp; SDL_Quit();</div><div>&nbsp; return 0;</div><div>}</div></div><div><br></div><div>/* END */</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
This will cause the application to crash when it's calling PHYSFS_init.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">There are a lot of things that seem to go wrong in windows.c</div>
<div style="font-family:arial,sans-serif;font-size:13px">Most of it seems to be related to the API calls and memory allocation.</div><div style="font-family:arial,sans-serif;font-size:13px">It doesn't matter if SDL is initialized before or after. Just initializing it at all causes PhysFS to crash.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">The first line that fails during init is line 470 of windows.c:</div><div style="font-family:arial,sans-serif;font-size:13px">
wstr = (LPWSTR) __PHYSFS_smallAlloc(psize * sizeof (WCHAR));<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I have a hunch that compiling this on other platforms might be more successful.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Am I just doing something terribly wrong here or is PhysFS incompatible with SDL 2.0?</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Regards,</div><div style="font-family:arial,sans-serif;font-size:13px">Thomas Lokshall</div>
_______________________________________________<br>physfs mailing list<br><a href="mailto:physfs@icculus.org">physfs@icculus.org</a><br>http://icculus.org/mailman/listinfo/physfs<br></blockquote></div><br></body></html>