[PLUG] Converting C to java

Kyle Hayes kyle at silverbeach.net
Mon Jun 9 17:12:02 UTC 2003


On Monday 09 June 2003 12:56, Rich Shepard wrote:
>   Has anyone here done this? I'm looking for 1) tools (such as C2J and
> ephedra) that can automate at least part of the port and 2) estimates of
> how much time might be required (for the non-UI portions of the program).
> That is, would 100 lines/hour be reasonable for mathematical functions and
> the like?

As previously noted, SWIG does a fair job.  Java has the Java Native Interface 
API.  This is really pretty much a Java-to-C API (and vice versa I think).  
Never used it myself, but I have a book on it :-)  Look up JNI online at the 
main Sun Java site.  I seem to remember it being quite thorough.

If you're going to be doing some heavy lifting in the math world, then you 
should look around and make sure that someone hasn't already done the work of 
wrapping highly optimized libraries for you.  I keep hearing about scientific 
computing projects that use Java, so someone's done some wrapping.

Code translators will give you code that works, but a good way to do things in 
C may not be a good way to do things in Java and vice versa.  I've never used 
any of the tools, so I'm not going to guess how long it will take.

Best,
Kyle





More information about the PLUG mailing list