<div dir="ltr">Did you replace the DLLs after compiling? The application might still be using the old one if you forgot to do that.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 27 August 2014 10:10, Haydn Harach <span dir="ltr"><<a href="mailto:hharach@gmail.com" target="_blank">hharach@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">PHYSFS_openReadMulti compiles just fine, but then my app crashes because it can't find it in physfs.dll.  So, it found it in the .a, but not in the .dll?  what am I doing wrong compiling physfs? >.<</div>
<div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 26, 2014 at 9:51 AM, Haydn Harach <span dir="ltr"><<a href="mailto:hharach@gmail.com" target="_blank">hharach@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Now I'm having trouble rebuilding the project.  I'm trying to use a code::blocks project which I generated with cmake, changing only the 2 files (physfs.c and physfs.h).  It compiles and builds just fine, but I'm getting "undefined reference to PHYSFS_closeList" now.  What did I do wrong?</div>

<div><div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 25, 2014 at 6:55 PM, Haydn Harach <span dir="ltr"><<a href="mailto:hharach@gmail.com" target="_blank">hharach@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">Alrighty, here are the additions I've made to my physfs.c:<div><br></div><div><div>PHYSFS_File **PHYSFS_openReadMulti(const char *_fname)</div><div>{</div><div>    char *fname;</div><div>    size_t len;</div>



<div><br></div><div>    BAIL_IF_MACRO(_fname == NULL, ERR_INVALID_ARGUMENT, 0);</div><div>    len = strlen(_fname) + 1;</div><div>    fname = (char *) __PHYSFS_smallAlloc(len);</div><div>    BAIL_IF_MACRO(fname == NULL, ERR_OUT_OF_MEMORY, 0);</div>



<div>    </div><div>    FileHandle** ret = NULL;</div><div>    unsigned int retcount = 0;</div><div><br></div><div>    if (sanitizePlatformIndependentPath(_fname, fname))</div><div>    {</div><div>        int fileExists = 0;</div>



<div>        DirHandle *i = NULL;</div><div>        fvoid *opaque = NULL;</div><div><br></div><div>        __PHYSFS_platformGrabMutex(stateLock);</div><div><br></div><div>        GOTO_IF_MACRO(!searchPath, ERR_NO_SUCH_PATH, openReadEnd);</div>



<div><br></div><div>        /* !!! FIXME: Why aren't we using a for loop here? */</div><div>        i = searchPath;</div><div><div><br></div><div>        do</div><div>        {</div><div>            char *arcfname = fname;</div>



<div>            if (verifyPath(i, &arcfname, 0))</div><div>            {</div><div>                opaque = i->funcs->openRead(i->opaque, arcfname, &fileExists);</div><div>                if (opaque)</div>



</div><div>                {</div><div>                   // We found a valid file, let's prepare it.</div><div>                   FileHandle* h = (FileHandle*)allocator.Malloc(sizeof(FileHandle));</div><div>                   if (h == NULL)</div>



<div>                   {</div><div>                      i->funcs->fileClose(opaque);</div><div>                        GOTO_MACRO(ERR_OUT_OF_MEMORY, openReadEnd);</div><div>                   }</div><div>                   memset(h, 0, sizeof(FileHandle));</div>



<div>                   h->opaque = opaque;</div><div>                   h->forReading = 1;</div><div>                   h->dirHandle = i;</div><div>                   h->funcs = i->funcs;</div><div>                   h->next = openReadList;</div>



<div>                   openReadList = h;</div><div>                   </div><div>                     // Add the file to the list</div><div>                     FileHandle** temp = (FileHandle**)allocator.Malloc(sizeof(FileHandle) * (retcount + 1));</div>



<div>                     if (temp == NULL)</div><div>                     {</div><div>                        allocator.Free(h);</div><div>                        i->funcs->fileClose(opaque);</div><div>                        GOTO_MACRO(ERR_OUT_OF_MEMORY, openReadEnd);</div>



<div>                     }</div><div>                     if (ret != NULL)</div><div>                     {</div><div>                        memcpy(temp, ret, sizeof(FileHandle) * retcount);</div><div>                        allocator.Free(ret);</div>



<div>                     }</div><div>                     temp[retcount] = h;</div><div>                     ++retcount;</div><div>                     ret = temp;</div><div><div>                }</div><div>            } /* if */</div>



<div>            i = i->next;</div><div>        } while ((i != NULL) && (!fileExists));</div><div><br></div></div><div>        // Add a null terminator to the list</div><div>        if (ret != NULL)</div><div>


        {</div>
<div>           FileHandle** temp = (FileHandle**)allocator.Malloc(sizeof(FileHandle) * (retcount + 1));</div><div>           if (temp == NULL)</div><div>               GOTO_MACRO(ERR_OUT_OF_MEMORY, openReadEnd);</div><div>



           </div><div>            memcpy(temp, ret, sizeof(FileHandle) * retcount);</div><div>            allocator.Free(ret);</div><div>            </div><div>            temp[retcount] = NULL;</div><div>            ret = temp;</div>



<div>        }</div><div><br></div><div>        openReadEnd:</div><div>        __PHYSFS_platformReleaseMutex(stateLock);</div><div>    } /* if */</div><div><br></div><div>    __PHYSFS_smallFree(fname);</div><div>    return ret;</div>



<div>} /* PHYSFS_openReadMulti */</div><div><br></div><div><div>int PHYSFS_closeList(PHYSFS_file** list)</div><div>{</div><div>   int retval = 1;</div><div>   </div><div>   for (PHYSFS_file** i = list; *i != NULL; ++i)</div>



<div>   {</div><div>      if (PHYSFS_close(*i) == 0)</div><div>         retval = 0;</div><div>   }</div><div>   </div><div>   allocator.Free(list);</div><div>   return retval;</div><div>}</div></div></div><div><br></div>


<div>
Is there anything not immediately obvious that I'm missing?</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 25, 2014 at 6:11 PM, Edward Rudd <span dir="ltr"><<a href="mailto:urkle@outoforder.cc" target="_blank">urkle@outoforder.cc</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Aug 25, 2014, at 8:06 PM, Haydn Harach <<a href="mailto:hharach@gmail.com" target="_blank">hharach@gmail.com</a>> wrote:<br>




<br>
> Looking at PHYSFS_openRead() in physfs.c, I've found this little snippet:<br>
><br>
> do<br>
>         {<br>
>             char *arcfname = fname;<br>
>             if (verifyPath(i, &arcfname, 0))<br>
>             {<br>
>                 opaque = i->funcs->openRead(i->opaque, arcfname, &fileExists);<br>
>                 if (opaque)<br>
>                     break;<br>
>             } /* if */<br>
>             i = i->next;<br>
>         } while ((i != NULL) && (!fileExists));<br>
><br>
> Now, from what I can see, this loop goes through all the paths, and the first one that satisfies the function and returns some data (from the openRead function) and causes 'opaque' to not be NULL, and thus breaks out of the loop.<br>




><br>
> So, if I replaced "if (opaque) break;" with "if (opaque) someVector.emplace_back(opaque, i);", then did some cleanup to ensure that I have a vector of FileHandle's instead of one, and return that, this should be exactly what I'm looking for, yes?<br>




<br>
</div>More or less, yes that would be exactly what you were looking for.<br>
<div><div>_______________________________________________<br>
physfs mailing list<br>
<a href="mailto:physfs@icculus.org" target="_blank">physfs@icculus.org</a><br>
<a href="http://icculus.org/mailman/listinfo/physfs" target="_blank">http://icculus.org/mailman/listinfo/physfs</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
physfs mailing list<br>
<a href="mailto:physfs@icculus.org">physfs@icculus.org</a><br>
<a href="http://icculus.org/mailman/listinfo/physfs" target="_blank">http://icculus.org/mailman/listinfo/physfs</a><br>
<br></blockquote></div><br></div>