[PPL-devel] [Fwd: Re: [Fwd: Re: Some troubles I met while building PPL.]]

Enea Zaffanella zaffanella at cs.unipr.it
Thu Apr 23 12:16:22 CEST 2009


@Yuriy:
please, direct all mails related to the PPL to the ppl-devel mailing list.


-------- Original Message --------
[...]
From: 	Yuriy Taraday
Subject: Re: [PPL-devel] [Fwd: Re: Some troubles I met while building PPL.]
To: zaffanella at cs.unipr.it
[...]

Oh, we didn't mention this function before.
I'm curious why "const jobject&"? jobject - just a pointer and constant
referencing to a pointer looks pointless.

On Thu, Apr 23, 2009 at 1:08 PM, Enea Zaffanella <zaffanella at cs.unipr.it
<mailto:zaffanella at cs.unipr.it>> wrote:

     Yuriy Taraday <yorik.sar at gmail.com <mailto:yorik.sar at gmail.com>> wrote:
     [...]

         By the way, in our project we use Java interface and we needed
         the value of
         PPL_Object.ptr to use in JNI library. May be, it should be somehow
         accessible from the outside? It might be useful for extending
         PPL and using
         it in conjunction with other libraries.


     Well, I am a bit reluctant in making this publicly accessible, since
     it is an implementation detail and we would like to have maximum
     freedom about it (for instance, currently not all PPL Java objects
     are derived from PPL_Object).

     Anyway, if you are working at the JNI level and you don't mind
     having to  fix your code whenever we might decide to change the
     implementation, then you should be able to extract the C++ pointer
     in the same way we currently do:

     [code snippet from interfaces/Java/jni/ppl_java_globals.cc]
     =================
      MIP_Problem* mip
        = reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
     =================

     Here we use the helper function `get_ptr' function from
     ppl_java_common.defs.hh:

     //! Returns a pointer to the C++ object wrapped by \p ppl_object.
     void*
     get_ptr(JNIEnv* env, const jobject& ppl_object);

     to obtain a void*, which is then immediately cast to the appropriate
     C++ pointer type.

     Regards,
     Enea Zaffanella.





More information about the PPL-devel mailing list