[plt-scheme] v299 FFI question

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Mon Sep 26 14:07:59 EDT 2005

> Also - when I define an enum: (define en (_enum '(a b c))) - how do I
> access the enumerated elements?

Hi Yoav,

Wherever a function expects a enumerated type value like 'en', we can pass
one of the symbols in the enumeration.  The enum type should magically
translate between the symbols and the integers.  For example, if we have
an enumeration like:

  (define _mysql-field-type
    (_enum '(decimal

and if we had a C function that returned an element of that enumeration,
from the mzscheme end of things, we'll get back symbols like 'decimal and
'double that are transparently translated from the C ints 0 and 5.

Hope this helps!

Posted on the users mailing list.