[Chicken-users] using constants from define-foreign-enum-type via a module

2010-07-26 Thread Martin DeMello
Here's some code I'm using to test various module features (attached, and at http://github.com/martindemello/test-chicken-modules) In cprog-binding.scm, I define a binding to a C enum via: (define-foreign-enum-type (ccount int) (ccount->int int->ccount)

Re: [Chicken-users] using constants from define-foreign-enum-type via a module

2010-07-26 Thread Jim Ursetto
The right way is to use include, foreign variables are not visible outside the compilation unit they are declared in. Alternatively if you want a user accessible interface to the constants, and do not want to use the conversion procedures, use regular old define and export that binding: (defi

Re: [Chicken-users] using constants from define-foreign-enum-type via a module

2010-07-26 Thread Martin DeMello
On Tue, Jul 27, 2010 at 1:20 AM, Jim Ursetto wrote: > The right way is to use include, foreign variables are not visible outside > the compilation unit they are declared in. > > Alternatively if you want a user accessible interface to the constants, and > do not want to use the conversion proced

Re: [Chicken-users] using constants from define-foreign-enum-type via a module

2010-07-26 Thread Jim Ursetto
[re-adding cc: to chicken-users, my fault] If you merely need the constant values, what you probably want is: (define c:zero (foreign-value "ZERO" int)) (define c:one (foreign-value "ONE" int)) (define c:two (foreign-value "TWO" int)) define-foreign-enum-type is for automatic conversion between