chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] question about foreigners


From: Hugo Arregui
Subject: [Chicken-users] question about foreigners
Date: Fri, 12 Apr 2013 10:16:20 -0300

Hi guys,

A little question about foreigners. I have this:

typedef struct JavaVMOption {
    ...
} JavaVMOption;

(define-foreign-record-type (jvm-option "JavaVMOption")
...)

typedef struct JavaVMInitArgs {
    ...
    JavaVMOption *options;
} JavaVMInitArgs;

Then I need to define a binding to JavaVMInitArgs in which I need to
set more than one jvm-option in the options field.

- My fist attempt was:

(define-foreign-record-type (jvm-init-args "JavaVMInitArgs")
  ...
  (jvm-option options jvm-init-args-options jvm-init-args-options-set!))

I can use jvm-init-args-options-set! to set one jvm-option, just using
(jvm-init-args-options-set! args option1). But I don't know how to set
a second one.

- Another alternative (doesn't work but I think could be theoretically
possible) is this:

(define-foreign-type struct-jvm-option "struct JavaVMOption") ; this
doesn't work (Error: illegal foreign argument type `JavaVMOption')

(define-foreign-record-type (jvm-init-args "JavaVMInitArgs")
  ...
  (struct-jvm-option (options 2) jvm-init-args-options
jvm-init-args-options-set!))

and then use jvm-init-args-options-set! with an index.

Could you give me a hint?

Thanks!,
Regards,
Hugo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]