[Swig-user] enum constants vs. functions returning an enum value
c.shoemaker at cox.net
Mon Aug 14 12:01:53 EDT 2006
On Mon, Aug 14, 2006 at 08:51:35AM -0400, Reed Hedges wrote:
> Chris Shoemaker wrote:
> > However, the wrapper for gncOwnerGetType() returns the enum value
> > immediately, not a thunk. E.g. "(gncOwnerGetType employee)" evaluates
> > to 1.
> > This means that the return value of the wrapper for the function that
> > returns an enum value is not comparable to the enum values.
> Doesn't this work? --
> (= (GNC-OWNER-EMPLOYEE) (gncOwnerGetType employee))
Yes, it does. I just didn't expect to have to treat enum constants as
functions, but maybe that's the easiest way to implement the wrapper.
I'm used to treating constants as immediate scheme objects. However,
I wouldn't be surprised if libguile didn't provide a mechanism for
binding symbols to immediate scheme objects. G-wrap wraps constants
as immediates, but it generates helper scheme code to do it.
More information about the gnucash-devel