This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Is cast (NonJavaObject*) to (long) legal for cni callback purposes?
- From: Tom Tromey <tromey at redhat dot com>
- To: Olivier de Mirleau <odmi at imc dot nl>
- Cc: java at gcc dot gnu dot org
- Date: 23 Jun 2006 11:50:57 -0600
- Subject: Re: Is cast (NonJavaObject*) to (long) legal for cni callback purposes?
- References: <449C0D01.7050805@imc.nl>
- Reply-to: tromey at redhat dot com
>>>>> "Olivier" == Olivier de Mirleau <odmi@imc.nl> writes:
Olivier> Hi, I'm currently using a procedure described below to do c2j2c
Olivier> callbacks with cni.
Olivier> It seems to work for now, but I'm not quite sure it's supposed to
Olivier> ALWAYS work.
Olivier> 1. I cast the pointer to the NonJavaClass instance to a long and pass
Olivier> that as a jlong to java.
With gcj (and CNI) you can also use the 'RawData' class for this
purpose. There's a section in the gcj manual about this. Basically
RawData is handled specially by the compiler and the runtime and is
kind of like 'void*'.
One slight advantage of this over using jlong is that you may
(depending on packing) get a space savings on 32 bit systems.
Tom