This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Help, writing kawa equivalent of java program
- From: Per Bothner <per at bothner dot com>
- To: Sudarshan S Chawathe <chaw at eip10 dot org>, Vasantha Ganesh <vasanthaganesh dot k at gmail dot com>
- Cc: kawa at sourceware dot org
- Date: Sat, 1 Apr 2017 13:25:16 -0700
- Subject: Re: Help, writing kawa equivalent of java program
- Authentication-results: sourceware.org; auth=none
- References: <29747.1491078000@vereq.eip10.org>
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/