This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Compiling .java file to shared library
- From: Andi Vajda <andi at osafoundation dot org>
- To: Mike Purdy <purdymi at binghamtonschools dot org>
- Cc: java at gcc dot gnu dot org
- Date: Tue, 26 Sep 2006 09:13:44 -0700 (PDT)
- Subject: Re: Compiling .java file to shared library
- References: <s518ebf2.006@HSGW1.bcsd>
- Reply-to: Andi Vajda <andi at osafoundation dot org>
On Tue, 26 Sep 2006, Mike Purdy wrote:
So, now I've successfully applied the dawrin x86 patches to a 4.0.2 tarball
and have successfully built it.
Now, I would like to take a .java file and compile it into a native shared
library so that I could link and use it in a c++ application. gcj -c -g -O
MyLibrary.java successfully creates an .o file. What is the next step to
making a shared library?
To use it from C++, you have to generate a C++ header file for your class
using gcjh and use that to compile calls into it.
I do something very similar when building PyLucene (a shared library serving
as a python extension integrating Java Lucene). Take a look at its Makefile
for examples:
http://svn.osafoundation.org/pylucene/trunk/Makefile
Andi..