lcc Backend for Java

Hosted by
SourceForge Logo

I have created an expiremental backend for lcc which compiles to java source code. While it is always better to port your C code to java by some other means, it can be difficult, especially when the C code in question uses features which are not support by java (such as goto and unions) and also when the execution speed of the ported code is not critical.

The backend files must be installed into the lcc-4.1 directory in order to work. There is an installation and usage document that tells how this works. Once you have done the installation and compiled the examples, you will be able to compile C sources to Java source and call them from your java sources as normal. Note that arguments to C functions are pushed onto the C stack, and that C return values are passes in c_program.eax (yes, this backend came from x86). Compiled code either called by or calling compiled C programs must use the C stack, and C return convention. I'd like some feedback on making this easier (possibly by making the proxy functions written into the compiled class files do this automatically).

News

Tue May 22 17:03:21 CDT 2001
First, I would like to apologise for not maintaining this project better. I intend to do some small improvements before years' end (yes, currently 7 months away), and integrate support for the C library java port that was pointed out to me some time ago. My first step is to make the link step better, and to allow linking against pre-compiled .class files when required.

Things you need

lcc-4.1.tar.gz
lcc-java.tar.gz

I didn't combine these because of the license on lcc-4.1, which can be found here my sources are under GPL and lcc-4.1 is not, although the license allows me to distribute it here for noncommercial use.

Things it needs

It would be pleasing if someone was willing to port the C library so that whole programs could be useful compiled to Java, that would be nice. It was not part of the project I wrote this for, but if anyone else cares to write it, I'd be glad to distribute it here.