Storing C++ data in an instance field using CNI?

Paul Gear paul@gear.dyndns.org
Tue May 25 18:43:00 GMT 2004


Tom Tromey wrote:
>>>>>>"Paul" == Paul Gear <paul@gear.dyndns.org> writes:
> 
> 
>>>http://gcc.gnu.org/onlinedocs/gcj/Mixing-with-C--.html
> 
> 
> Paul> One more question: I notice in the examples that the field is defined in
> Paul> the C++ source instead of the Java source.  Is this the recommended best
> Paul> practice, or is it simply up to personal preference?  My natural
> Paul> inclination is to put as much as possible in the Java source and write
> Paul> only the parts actually required in C++.
> 
> The normal practice is to declare all fields in Java, compile to
> .class, and then in turn generate a C++ header file for your class
> using gcjh.  This will generate the C++ class declaration for you,
> including field declarations.

Yup - got that part already.  I just wanted to make sure i wasn't
missing something in the way fields were declared.

More questions along the same topic: has _Jv_AllocBytes been deprecated
or something?  It appears in the doco at
http://gcc.gnu.org/java/papers/cni/t1308.html
and
http://gcc.gnu.org/onlinedocs/gcj/Object-allocation.html#Object%20allocation
but when i try to use it it is not defined.

(I'm also not sure which one of the above doco links i should be working
from.  I'm using gcc 3.3.1 on Red Hat Linux 9.)

Also, assuming _Jv_AllocBytes() is still the right thing to use, does it
return zeroed memory?

Thanks again,
Paul
http://paulgear.webhop.net
-- 
Think context!  Using accepted quoting conventions makes
your email easier to understand.  Learn how at
<http://www.netmeister.org/news/learn2quote.html>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://gcc.gnu.org/pipermail/java/attachments/20040525/4a400505/attachment.sig>


More information about the Java mailing list