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

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to