[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: GCJ and C/C++ applications how is it possible ?



On Wed, May 22, 2002 at 11:36:06PM +0200, Pac wrote:
| 
| [...]
| dman> $ ./a.out
| dman> Hello World
| 
| thanks but I all ready knew that !!!

:-).

| dman> 
| dman> | into a library and to use it into
| dman> | 
| dman> | a GTK+ application
| dman> | a Qt application
| dman> | 
| dman> | ??
| dman> 
| dman> To make use of existing C/C++ libraries requires writing JNI (or CNI)
| dman> bridge code in C/C++ to provide a Java interface that your Java code
| dman> can access.  GCJ doesn't provide auto wrappers like that, it just
| dman> turns your java source into native binaries.
| 
| I dont want to use a C/C++ library inside a java programm, I whave a
| set java classes compiled into a native library (with compilation
| option shared from gcj) and want to use this library into a Qt or GTK+
| application.

Oh, I see.

| Isnt it possible ? 

Anything is possible ... though the effort required varies :-).

| See this from http://gcc.gnu.org/gcc-3.1/changes.html : 
| 
| " # JNI and CNI invocation interfaces were implemented, so gcj-compiled Java code can now be called from a C/C++ application.

I didn't know that.  That's a good feature to have.  I guess you'll
have to RTFM the gcc docs to find out what that API is.  Maybe it
works just like compiling a C++ library except that you'll be missing
the C++ header files (unless it can generate them too).

| dman> 
| dman> For GTK+ you can take a look at http://java-gnome.sourceforge.net/.
| 
| thank you 
| I will read this

Does your GTK+ app already exist in C/C++?  If not, then you can use
java-gnome to write your app in Java and use the java libs directly.
You also have the option of using jython and java-gnome together to
write a non-distributed GTK+ app in python and still use java libs.
Some of the interoperability options are rather interesting to
consider.

-D

-- 

Q: What is the difference betwee open-source and commercial software?
A: If you have a problem with commercial software you can call a phone
   number and they will tell you it might be solved in a future version.
   For open-source sofware there isn't a phone number to call, but you
   get the solution within a day.
 
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg

Attachment: pgpmtzLhslM7Q.pgp
Description: PGP signature


Reply to: