This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
RE: newbie question: need help linking
- From: "Prabhakar, Vijay (IT)" <Vijay dot Prabhakar at morganstanley dot com>
- To: "Andrew Haley" <aph at redhat dot com>
- Cc: <java at gcc dot gnu dot org>
- Date: Wed, 1 Dec 2004 10:33:01 -0500
- Subject: RE: newbie question: need help linking
Hmm, what about a native method that's written as part of a Java class
that's compiled with gcj. Can that be called from a .class file? I was
thinking about writing a class for wrapping and unwrapping primitives
when communicating between C++ and Java. In other words, I was hoping
to have a class converts RawData objects which are actually arrays (or
vectors/other STL datastructures) of C++ primitives and returns arrays
of Java primitives. Would I be better off writing a C++ template that
converts C++ primitives into j<primitive> arrays so that it can
communicate with the Java code?
-Vijay
-----Original Message-----
From: java-owner@gcc.gnu.org [mailto:java-owner@gcc.gnu.org] On Behalf
Of Andrew Haley
Sent: Wednesday, December 01, 2004 9:28 AM
To: Prabhakar, Vijay (IT)
Cc: java@gcc.gnu.org
Subject: Re: newbie question: need help linking
Prabhakar, Vijay (IT) writes:
> Hi, I'm having a few problems with which I was hoping someone could
help
> me out. I'm using GCJ 3.2.3-42. I'm not sure if this is possible,
> which might explain why I can't get this system running. I have a
> program that is written in C++ and it uses several libraries. I'm
> trying to change one of the libraries to Java while leaving a C++
> interface to it so the original program can continue running without
> changes.
>
> So essentially, I have a C++ class with a main, calling another C++
> class which calls a Java class. So I compile my Java class with GCJ
and
> produce the C++ header file. Both C++ classes compile fine as well.
> However, I cannot get the program to link. I can get it to link if I
> compile the Java source file to an object file, but not a class file.
Right: that's what gcj does. There is, at present, no easy way to
call CNI code directly from a .class file. It can be done indirectly,
but that's another matter.
Andrew.
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited.