Class.h and Class.java both define zero-arg constructor

Bryce McKinlay bryce@waitaki.otago.ac.nz
Mon Dec 10 20:25:00 GMT 2001


Adam Megacz wrote:

>>At the moment it looks like either the Class.h one gets inlined or
>>the Class.java one gets called. Calling the Class.java one shouldn't
>>be a problem from C++ even though it is private, assuming it works.
>>
>
>How about the line
>
>   ((_Jv_Self *)this)->vtable_ptr -= 2 * sizeof (void *);
>
>is that cruft, or will I run into problems with it missing?
>

It is definatly needed if the C++ constructor is being called. If the 
Java constructor gets called, the vtable pointer might not get set like 
C++ expects, so it may be neccessary to add something like

((_Jv_Self *)primclass)->vtable_ptr = the_vtable;

at the call site.

regards

Bryce.




More information about the Java mailing list