gcj

Plapp, Phillip phillip.plapp@hp.com
Tue Apr 27 15:24:00 GMT 2004


Hello GNU guys,

I have a question concerning GCJ, CNI and nested java classes.  The
following is my java class scenario in
which class A contains an instance of a nested class B:

Class  A
{

   B b;

        Class B
        {
                int getSize();
        }
}

In my CNI style C++ file, I  have the following code that attempts to
access b->getSize() through a, which is an instance of A



#include <A.h>     		// line number 3

A$B *tmp = (A$B*)a.getB;	// line number 180
jint size = tmp->getSize();	// line number 181




When I compile with gcj, I get the following error:
Test.cpp:181: error: invalid use of undefined type 'A$B'

As you can see, the compiler didn't have a problem with line 180 where I
got the instance b of class B.  The problem 
came when I tried to use the instance of b.  I assume this is because
there is no A$B header file.  I tried to produce the 
A$B.h file, but gcjh only produced the A.h file even when I ran 
gcjh A$B.

Any ideas?

You guys make good stuff!
Thanks!
Phil

  



More information about the Gcc-help mailing list