[LLVMdev] Converting C++ to Java

Justin Holewinski justin.holewinski at gmail.com
Tue Nov 16 07:10:48 PST 2010


On Tue, Nov 16, 2010 at 4:06 AM, Shaun Southern <shaun at team3games.com>wrote:

> Hi
>
>
>
> 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.
>
>
>

Emitting Dalvik byte-code (Android does not use standard Java byte-code)
would require a new target back-end in LLVM.

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!

To get full C++ support including STL, exceptions, and RTTI, look at
Crystax's build of the NDK:  http://www.crystax.net/


> 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”.
>
>
>
>
>
> Thanks, looking forward to your replies !
>
>
>
>
>
> Shaun Southern
>
> Team 3 Games Ltd
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>


-- 

Thanks,

Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101116/a1831342/attachment.html>


More information about the llvm-dev mailing list