Subclassing CNI classes (GCJ)
Andrew Haley
aph@redhat.com
Mon Jan 19 14:22:00 GMT 2015
On 19/01/15 12:57, Andreas Besting wrote:
> Hi everyone,
>
> I have a problem subclassing CNI classes in c++. Following the examples at
>
> https://gcc.gnu.org/onlinedocs/gcj/Mixing-with-C_002b_002b.html#Mixing-with-C_002b_002b
>
> , I tried to subclass java::lang::Object using
>
> class MyClass : public java::lang::Object{ ... }
>
> The code compiles fine, however as soon as I try to instantiate the
> class with
>
> MyClass * c = new MyClass();
>
> I get an error:
> error: canât find âclass$â in âMyClassâ
>
> The problem seems to be the (missing) static member
>
> static ::java::lang::Class class$;
>
> used in every CNI class declaration. Adding this member does not resolve
> the problem.
>
> Any ideas?
I'd declare the class in Java, then fill in the members in C++, as needed.
Andrew.
More information about the Gcc-help
mailing list