Open danielsz opened 5 years ago
Good question!
I don't have any preference nor idiom at this moment. I usually write binding layers as close as native C APIs, then put some user-level APIs in, what I think, scheme way. It might be an idea that providing a utility macro which emulates C enum. Something like this:
(define-c-enum gtk-window
(toplevel 1)
other1
(other2 5)
...)
#|
;; expands to
(define gtk-window int)
(define gtk-window:toplevel 1)
(define gtk-window:other1 2)
(define gtk-window:other2 5)
|#
Other option would be using R6RS enum, thought this may not fit to C enum usage.
I think this approach makes a lot of sense indeed. Thank you!
Hi,
I am just playing/exploring, but I love this library! A question came up when I was trying to do a minimal hello world example with gtk+. How would we represent foreign enums, like GTK_WINDOW_TOPLEVEL? I know I can pass an int corresponding to the value of the enum, but I'm interested in the more idomatic, correct way to do this in pffi. Thanks!