Embedding kaffe

Daniel Veillard veillard at rufus.w3.org
Fri Nov 14 08:14:36 PST 1997


>In the build process, kaffe builds a bunch of libraries (libkaffe_vm.so,
>libkaffe_agent.so, etc) that seem to contain most of the functionality
>needed to embed a Java interpreter in a C program.  I'm interested in
>doing that and am about to start reading source code (since there 
>isn't much documentation :)  I was wondering if anyone had any pointers,
>thoughts, or hints on what to start looking at.  If someone had done
>this already and had source they were willing to share that would be
>even nicer.

  I have embedded Kaffe in Amaya Web browser/editor of the W3C
you can fetch the code from Sunsite mirrors:

   ftp://sunsite.unc.edu/pub/Linux/apps/www/browsers/amaya/amaya-1.0b.src.tar.g
z

The glue code is in the directory javalib, look at kaffeine.c,
a stub generator for Java/Kaffe->C is available in tools/javastubs
it produces the stubs by scanning C includes files for constants,
enums, and functions signatures. 

more informations on actually running/building Amaya at

    http://www.w3.org/Amaya/

(note that you also need the Thot library sources to build Amaya-java
 contact me it you really want to rebuild the Java version, not just
 looking at the code)

>I'd like to be able to do the two obvious things that would be useful:
>
>1.  Take a C string of Java source code and compile it to a C string of 
>byte-code.
>2.  Execute a C string of byte-code in the Kaffe VM.
>
>Even a "yes, this isn't impossible under the current architecture"
>would be nice so that I know I'm not about to waste a lot of time.

  2/ should be clearly possible since that's what Kaffe engine does !

  1/ looks more like the Java compiler jobs, you could grab existing
     free replacement of javac written in C and embedd them too, should
     be possible but kaffe won't provide it directly I guess. 

Daniel
-- 
Daniel.Veillard at w3.org | MIT/LCS   Room NE43-344 | Today's Bookmarks :
Tel : +1.617.253.5884  | 545 Technology Square   | Linux, WWW, Java,
Fax : +1.617.258.5999  | Cambridge, MA 02139 USA | badminton, Kaffe,
http://www.w3.org/People/W3Cpeople.html#Veillard | HTTP-NG and Amaya.




More information about the kaffe mailing list