From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28408 invoked by alias); 14 Feb 2012 11:26:51 -0000 Received: (qmail 28397 invoked by uid 22791); 14 Feb 2012 11:26:50 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_GC X-Spam-Check-By: sourceware.org Received: from mail-gx0-f175.google.com (HELO mail-gx0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Feb 2012 11:26:26 +0000 Received: by ggeq1 with SMTP id q1so2958169gge.20 for ; Tue, 14 Feb 2012 03:26:26 -0800 (PST) Received: by 10.50.179.8 with SMTP id dc8mr3002275igc.19.1329218786035; Tue, 14 Feb 2012 03:26:26 -0800 (PST) Received: from [192.168.1.100] ([150.203.103.217]) by mx.google.com with ESMTPS id z22sm34068921ibg.5.2012.02.14.03.26.24 (version=SSLv3 cipher=OTHER); Tue, 14 Feb 2012 03:26:25 -0800 (PST) Message-ID: <4F3A44DB.4070605@gmail.com> Date: Tue, 14 Feb 2012 11:26:00 -0000 From: Yi Lin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: java@gcc.gnu.org Subject: Re: Interface gcj-compiled library with Java programs in a runtime (other than gij)? References: <4F387D25.40406@gmail.com> <1586090240029193189@unknownmsgid> <4F389217.7040506@gmail.com> <4F395754.3070407@gmail.com> <4F3A2DC7.3000502@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact java-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-owner@gcc.gnu.org X-SW-Source: 2012-02/txt/msg00014.txt.bz2 Thank you all for the answers. I think I have some clue about CNI/JNI on the interface. But I still have doubt about how a shared library compiled from Java can be used by a) c/c++, b) Java code running on other JVM (not libgcj interpreter). I think b) is straightforwad if a) is possible. So for a), is calling a shared library of compiled java code any different than calling a shared library from normal c/c++ code? I have been spending two days exploring this and trying different approaches. My expectation is to load the compiled Java lib and use its method via dlopen, dlsym, etc. I guess another possibility is to use JvCreateVM(), and do everything in Java fashion. I don't have any success in either yet. Any hint would be very helpful so I could stop wasting time on a wrong track. Thanks, Yi On 2012/2/14 21:31, Bryce McKinlay wrote: > On Tue, Feb 14, 2012 at 9:47 AM, Andrew Haley wrote: >> On 02/13/2012 06:32 PM, David Daney wrote: >>> I am just going from memory here, but I think that the interpreter can >>> only call native code via JNI. >> Ahh, if that were really true, interpreted code couldn't call >> Object.() ... > > David is saying that "native" methods in interpreted classes can't be > implemented with CNI. Which is true, I think. > > Obviously, the interpreter can call native CNI methods in other > (non-interpreted) classes, like Object. Hence the trampoline example. > > Bryce