Subclassing CNI classes (GCJ)

Andreas Besting besting@surgitaix.com
Mon Jan 19 12:57:00 GMT 2015


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?
Thank you in advance,
Andreas




More information about the Gcc-help mailing list