Hello,
I am using chicken 4.7.0, and in the course of writing some library
bindings, I came upon a difference between define-foreign-type and
define-foreign-enum-type that puzzles me. Here is a minimal program
that shows it:
(import chicken scheme foreign foreigners)
#>
typedef enum {
pain,
suffering,
fear
} garmonbozia;
void creepy_dream (garmonbozia *x) {
printf("give me back my garmonbozia!\n");
*x = fear;
}
<#
;;; this compiles:
(define-foreign-type garmonbozia "garmonbozia")
;;; this does not:
;; (define-foreign-enum-type (garmonbozia "garmonbozia")
;; (garmonbozia->int int->garmonbozia)
;; pain suffering fear)
(define (creepy-dream)
(let-location ((a int))
((foreign-lambda void creepy_dream (c-pointer garmonbozia))
(location a))
a))
(print (creepy-dream))
It compiles and works fine with the 'define-foreign-type' form, but if I
comment that one out, and uncomment the 'define-foreign-enum-type' form,
I get the following error:
Error: illegal foreign return type `garmonbozia'
Error: shell command terminated with non-zero exit status 256:
/usr/bin/chicken enumpointer6.scm -output-file enumpointer6.c
Can somebody explain the difference?
Thank you,
--
John Foerch
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users