<div>Now that I have electricity again...</div>
<div> </div>
<div>Sorry, I was looking too deep, not noticing that the function returned a std::string.  The problem was up higher in CIndex.cpp, in a couple of the functions that return const char *, with the same problem I described of the temporary going away before the string can be used.</div>

<div> </div>
<div>I worked around it by using a static buffer, which is admittedly not so good.  A cleaner way might be to have the user pass in a string buffer, since it seems this needs to be a C interface.  Should I do that, or does the API need to remain unchanged?  Let me know if there's a better way.</div>

<div> </div>
<div>The enclosed patch contains my hacked version, which also includes the DLL exporting glue (redone in the naming style I'm used to - apologies to Jeff Krall, who'd already done it).</div>
<div> </div>
<div>Note that I moved the getLocationFromCursor function out of the extern "C" {} because MSVC was complaining about it because of the object return type.</div>
<div> </div>
<div>Where does "basename" come from on the non-Windows platforms?  It was unresolved, so I guessed at it, but which seems to work.</div>
<div> </div>
<div>The c-index-api-test.m test passes on Windows with these changes.</div>
<div> </div>
<div>-John<br></div>
<div class="gmail_quote">On Mon, Oct 19, 2009 at 12:14 PM, John Thompson <span dir="ltr"><<a href="mailto:john.thompson.jtsoftware@gmail.com">john.thompson.jtsoftware@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>I'm looking at a test failure of c-index-api-test.m on Windows, and I've run into a problem I don't know how to easily fix.</div>
<div> </div>
<div>In the function Selector::getAsString function in IdentifierTable.cpp at line 330:</div>
<div> </div>
<div>    return II->getName().str() + ":";<br><br clear="all">On Windows, at least, this isn't working as expected.  I think it's because a tempory string created gets destructed before the return completes, causing the resulting string pointer to point to garbage, resulting in garbage for the identifier name in the index output.</div>

<div></div>
<div> </div>
<div>If someone more knowlegeable about it could take a look at it, I'd appreciate it.</div>
<div> </div>
<div>Note that if you need to run it on windows, you'll need some CIndex changes I'm working on, but haven't completed yet, so let me know if you need them.</div>
<div> </div>
<div>-John</div>
<div><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com" target="_blank">John.Thompson.JTSoftware@gmail.com</a><br><br></div></blockquote></div><br><br clear="all">
<div></div><br>-- <br>John Thompson<br><a href="mailto:John.Thompson.JTSoftware@gmail.com">John.Thompson.JTSoftware@gmail.com</a><br><br>