This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is cast (NonJavaObject*) to (long) legal for cni callback purposes?


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]