[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] define-foreign-enum-type
From: |
John J Foerch |
Subject: |
[Chicken-users] define-foreign-enum-type |
Date: |
Thu, 26 Apr 2012 22:40:59 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) |
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] define-foreign-enum-type,
John J Foerch <=