<div class="gmail_quote">On Tue, Nov 16, 2010 at 4:06 AM, Shaun Southern <span dir="ltr"><<a href="mailto:shaun@team3games.com">shaun@team3games.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal">Hi</p><p class="MsoNormal"> </p><p class="MsoNormal">We want to use our existing engine sourcecode to build Java applications. Our core engine is written in C/C++ and has hooks to platform specific functions which we have filled in for lots of platforms so far, PC, DS, PS2, PSP, XBOX, IPHONE etc. All of which can use C/C++ as their compiler. However now we want to target Android platforms, so we are looking into converting the main body of code automatically into Java. This means as we add code to the main engine, we don’t have to keep adding Java code – w would like to just convert it automatically. We have looked at converter software, but even the “best” won’t touch pointer arithmetic. We don’t use this excessively, but certain parts of the engine do use it for streaming data, building variable length lists, etc, and we also have internal memory allocation code which “grabs” a large area of memory at the start, then casts parts of it to all sorts of different structures.</p>
<p class="MsoNormal"> </p></div></div></blockquote><div><br></div><div>Emitting Dalvik byte-code (Android does not use standard Java byte-code) would require a new target back-end in LLVM.</div><div><br></div><div>The question I have is:  why port everything to Dalvik byte-code?  You can use the Android NDK to compile native C/C++ and just write your "hook" functions in Java with an appropriate JNI interface.  This seems like it would save a lot of time!</div>
<div><br></div><div>To get full C++ support including STL, exceptions, and RTTI, look at Crystax's build of the NDK:  <a href="http://www.crystax.net/">http://www.crystax.net/</a></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal">Is it going to be possible to use LLVM to convert our platform agnostic engine code to Java, then link in the “hook” functions entirely written in Java. These functions do things such as “read data from file”, “play sound effect”, “draw triangle”.</p>
<p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">Thanks, looking forward to your replies !</p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">Shaun Southern</p><p class="MsoNormal">
Team 3 Games Ltd</p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p></div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>