Return-Path: X-Original-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Delivered-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 89F52F90D for ; Mon, 2 Sep 2013 08:01:05 +0000 (UTC) Received: (qmail 97484 invoked by uid 500); 2 Sep 2013 08:01:05 -0000 Delivered-To: apmail-lucene-pylucene-dev-archive@lucene.apache.org Received: (qmail 97382 invoked by uid 500); 2 Sep 2013 08:01:05 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 97373 invoked by uid 99); 2 Sep 2013 08:01:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Sep 2013 08:01:04 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [50.0.193.30] (HELO ovaltofu.org) (50.0.193.30) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Sep 2013 08:00:58 +0000 Received: from [192.168.1.11] (AOrleans-651-1-220-28.w90-24.abo.wanadoo.fr [90.24.75.28]) (authenticated bits=0) by ovaltofu.org (8.14.4/8.14.4) with ESMTP id r82807Zu001844 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 2 Sep 2013 01:00:10 -0700 (PDT) References: <7b41c13397344302b1683f9ca43b0c85@AMXPR07MB088.eurprd07.prod.outlook.com> <5f7efc856a214224b4e50c3a5a2a6fad@AMXPR07MB088.eurprd07.prod.outlook.com> <70D3011B-8E89-4769-A008-71F8CD3C4A9E@apache.org> <29a6a5861e7b4dcf8211f50b06028900@DB3PR07MB090.eurprd07.prod.outlook.com> Mime-Version: 1.0 (1.0) In-Reply-To: <29a6a5861e7b4dcf8211f50b06028900@DB3PR07MB090.eurprd07.prod.outlook.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: Cc: "pylucene-dev@lucene.apache.org" X-Mailer: iPhone Mail (10B329) From: Andi Vajda Subject: Re: JCC for Java -> C++ and initializeClass Date: Mon, 2 Sep 2013 10:00:06 +0200 To: Toivo Henningsson X-Virus-Checked: Checked by ClamAV on apache.org On Sep 2, 2013, at 9:56, Toivo Henningsson w= rote: >> -----Original Message----- >> From: Andi Vajda [mailto:vajda@apache.org] >> Sent: den 30 augusti 2013 16:11 >> To: Toivo Henningsson >> Cc: pylucene-dev@lucene.apache.org >> Subject: Re: JCC for Java -> C++ and initializeClass >>=20 >>=20 >> On Aug 30, 2013, at 15:55, Toivo Henningsson >> wrote: >>=20 >>>> -----Original Message----- >>>> From: Andi Vajda [mailto:vajda@apache.org] >>>> Sent: den 30 augusti 2013 15:13 >>>> To: pylucene-dev@lucene.apache.org >>>> Subject: Re: JCC for Java -> C++ and initializeClass >>>>=20 >>>>=20 >>>> On Fri, 30 Aug 2013, Toivo Henningsson wrote: >>>>=20 >>>>> I've been using JCC successfully for a number of months for wrapping >>>>> Java >>>> code to use in a C++ program. >>>>> My question is about initializeClass. Right now, I'm calling >>>>>=20 >>>>> mypackage::MyClass::initializeClass(false); >>>>>=20 >>>>> on some of my classes during initialization (in the C++ code), as I >>>>> got the >>>> impression that I am supposed to do. But it doesn't seem to make a >>>> difference if I remove those calls. Is it still required, and if it is,= for what? >>>>=20 >>>> initializeClass() is called for you, lazily, when the C++ wrapper >>>> class constructor is called for the first time. >>>> You can see this in the generated .h files. >>>=20 >>> Ok, great! >>>=20 >>> So it's only if I need to use something inside of a class before creatin= g any >> instances that I need to call initializeClass()? >>=20 >> Thinking about this, from C++, there may be holes. =46rom Python, when im= port >> on the Python wrapper is called, initializeClass() ends up being called t= oo. >=20 > I looked a bit at the source (generated and otherwise), and my conclusion w= as that > * initializeClass() looks up class, method, field ids and static fields =3D= =3D> it needs to be called before > * calling methods on the class (also static ones) > * accessing fields in the class > * intializeClass() is called when > * a wrapper instance is created > * a static method is called > I think that this leaves only the case when accessing a static field, whic= h indeed is a hole. >=20 > My only question now is: Do you plan to keep the other three cases (callin= g static/nonstatic methods, access to instance fields) safe when it comes to= initializeClass? > Then I can write my code under that assumption. Yes, this has been quite stable and I don't anticipate any changes there. Andi.. >=20 > / Toivo >=20 > Toivo Henningsson, PhD > Software Engineer > Simulation & Optimization R&D >=20 > Phone direct: +46 46 286 22 11 > Email: toivo.henningsson@modelon.com >=20 >=20 >=20 > Modelon AB > Ideon Science Park > SE-223 70 Lund, Sweden Phone: +46 46 286 2200 > Fax: +46 46 286 2201 > Web: http://www.modelon.com > This email and any attachments are intended solely for the use of the indi= vidual or entity to whom it is addressed and may be confidential and/or priv= ileged. If you are not one of the named recipients or have received this ema= il in error, (i) you should not read, disclose, or copy it, (ii) please noti= fy sender of your receipt by reply email and delete this email and all attac= hments, (iii) Modelon does not accept or assume any liability or responsibil= ity for any use of or reliance on this email. >=20