From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126505 invoked by alias); 1 Apr 2017 20:25:34 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 125256 invoked by uid 89); 1 Apr 2017 20:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 01 Apr 2017 20:25:31 +0000 Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1cuPaT-000683-Lg; Sat, 01 Apr 2017 22:25:29 +0200 Received: from 70-36-239-167.dsl.dynamic.fusionbroadband.com ([70.36.239.167] helo=localhost.localdomain) by mailfront12.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1cuPaJ-0008IK-9k; Sat, 01 Apr 2017 22:25:19 +0200 Subject: Re: Help, writing kawa equivalent of java program To: Sudarshan S Chawathe , Vasantha Ganesh References: <29747.1491078000@vereq.eip10.org> Cc: kawa@sourceware.org From: Per Bothner Message-ID: Date: Sat, 01 Apr 2017 20:25:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <29747.1491078000@vereq.eip10.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q2/txt/msg00013.txt.bz2 On 04/01/2017 01:20 PM, Sudarshan S Chawathe wrote: >> (define-alias library com.sun.jna.Library) >> (define-alias native com.sun.jna.Native) >> >> (define-simple-class libc (library) >> interface: #t >> (getpid::long)) >> >> (define inst::libc (native:loadLibrary "c" libc:class)) >> (display (inst:getpid)) > > I think you need to define the interface to have a getpid method with > the proper signature. Here is a small example, somewhat similar to your > code, that I tried a while back and that works: > > (define-simple-class clib (com.sun.jna.Library) > interface: #t > ((puts (s ::String)) ::void #!abstract)) Kawa should be able to infer the signature, so I believe you can write: ((puts (s)) #!abstract)) The problem is that: (getpid::long) defines a field, not a method (and non-statuc fields aren't allowed in interfaces). Kawa should probably catch this error. -- --Per Bothner per@bothner.com http://per.bothner.com/