[fedora-java] How to link C++ code to a java library?

Mark Wielaard mark at klomp.org
Wed Nov 19 08:33:52 UTC 2008


Hi Orcan,

On Tue, 2008-11-18 at 22:14 -0800, Orcan Ogetbil wrote:
> After some consultation in IRC, I've been told that JNI is not what we
> need in this case. And a suggestion came up: Apparently we can use GCJ
> to do this job. But this will require non-trivial hacking. Can anyone
> point me to some guidelines for this and/or give me a head-start?

The program, pdftk, is a c++ program that uses gcj's CNI (not JNI)
feature to call java classes. Here is some background information on
CNI: http://gcc.gnu.org/onlinedocs/gcj/About-CNI.html

In principle you would only need to provide CNI headers for the itext
classes (see gcjh) and a shared library build from the itext classes or
jar file (see gcj). But it depends a bit on coordinating with the pdftk
packager. Currently the pdftk build seems to just bundle all of itext
and compile it into one big static library.

Cheers,

Mark




More information about the java-devel mailing list