This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help, writing kawa equivalent of java program


Sorry for excluding the code, here it goes:

(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))

On Sun, Apr 2, 2017 at 1:28 AM, Vasantha Ganesh
<vasanthaganesh.k@gmail.com> wrote:
> Hello Mr. Bothner,
>   I still get this error:
>
> [homonculus@alchemist kawa-scheme]$ kawa -J-cp
> -J/usr/share/java/jna.jar:.:/usr/share/java/kawa-2.0.jar -f
> jnagetpid.scm
> Exception in thread "main" java.lang.ClassFormatError: Illegal field
> modifiers in class libc: 0x1
>     at java.lang.ClassLoader.defineClass1(Native Method)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
>     at gnu.bytecode.ArrayClassLoader.loadClass(ArrayClassLoader.java:125)
>     at gnu.expr.ModuleExp.evalToClass(ModuleExp.java:135)
>     at gnu.expr.ModuleExp.evalModule1(ModuleExp.java:259)
>     at gnu.expr.ModuleExp.evalModule(ModuleExp.java:214)
>     at kawa.Shell.run(Shell.java:291)
>     at kawa.Shell.runFile(Shell.java:524)
>     at kawa.Shell.runFileOrClass(Shell.java:447)
>     at kawa.repl.processArgs(repl.java:260)
>     at kawa.repl.main(repl.java:871)
>
> Thank you,
> Vasantha Ganesh K.
>
> On Sun, Apr 2, 2017 at 1:22 AM, Per Bothner <per@bothner.com> wrote:
>> On 04/01/2017 12:44 PM, Vasantha Ganesh wrote:
>>>
>>>   Thank you, that did work. Kawa complains that the interface that I
>>> created in kawa is not an interface.
>>
>>
>> (define-simple-class libc (library)
>>   (make-interface #t)
>>   (getpid::long))
>>
>> - defines a field named make-interface.
>> You probably want:
>>
>> (define-simple-class libc (library)
>>   interface: #t
>>   (getpid::long))
>>
>> --
>>         --Per Bothner
>> per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]