<div dir="ltr">i tried to hold CXIndex as static variable in native code (array of pointers to be more detailed) and pass just index to java back and then pass index to native code in order to hold variable in native code without passing.<div>
<br></div><div>Still the same result.</div><div>I can check it easily using clang_getTranslationUnitSpelling().</div><div>Before passing it returns filename and ater packing/unpacking (even using index) it returns nothing.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/11 Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="im">On 11 October 2013 10:02, Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The problem is that if i do in the same invocation from java (f.e. in single Java_name_antonsmirnov_clang_clang_1wrapper_tokenize() function) - it works good.</div>


<div>For example if i just remember parameters and then create index, parse, tokenize (clang-c invocations) within tokenize() method it's okay.</div><div><br></div><div>If i do everything in separate native methods (clang-c invocation in separate native calls from java) (as it's designed to do) pointers are corrupted.</div>


<div>So unpacked CXIndex in parse() invocation is corrupted even if it was packed/unpacked correctly and the pointer is the same.</div></div></blockquote><div></div></div><br></div></div><div class="gmail_extra">This looks a lot like standard JNI stack corruption to me. This is the exact same behaviour I've seen in JNI 10 years ago, and I'm not surprised they're still there...</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">cheers,</div><div class="gmail_extra">--renato</div></div>
</blockquote></div><br></div>