This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Incorrect Java methods called from CNI


Am Freitag, 7. Mai 2004 22:48 schrieb Dave Menendez:
> I'm hoping that someone else has seen this problem and knows of a
> possible workaround or fix.  I am using GCC 3.4.0 and GCJ to compile
> several Java -source- files.  I use gcjh to generate header files for
> all these Java files.  I have some C++ code that successfully
> instantiates the Java object and calls some methods on it.  So far,
> things are working great.
>
> However, I've just run into a problem that didn't seem to make any
> sense, and by adding a few basic System.out.println statements
> directly in the Java source and regenerating all the files, I've
> determined that the method I invoke from C++ is actually calling the
> wrong method on the Java object.  For example, in C++ I invoked
> SomeJavaObj->clear(), but according to the println's I placed in the
> Java object itself, SomeJavaObj.add() was the actual method that got
> invoked.
>
> Other methods work, but this is the first one I've come across where
> the wrong method altogether was invoked.  The method I'm calling
> isn't anything out of the ordinary, like an implementation of an
> interface method, and the pointer I'm using is a pointer of the
> actual class type, not of an interface type, so I don't think I'm
> doing anything wacky here.  I even tried compiling without any
> optimization (-O0) instead of the default used by autoconf/automake
> (-O2).


Can you provide a testcase for this ? 


Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]