hi,

On Wed, Dec 12, 2007 at 11:48:48PM -0700, Shawn Rutledge wrote:

> > > (define-foreign-enum (dbus:bus (enum "DBusBusType"))
> > >       (dbus:session-bus DBUS_BUS_SESSION)
> > >       (dbus:system-bus DBUS_BUS_SYSTEM)
> > >       (dbus:starter-bus DBUS_BUS_STARTER) )
> >
> > i've been using
> >
> > (define-foreign-enum (dbus:bus int) ...)
> >
> > in cases like this.  don't know if it's the best solution, but it works.
> 
> That seems like it ought to work, but the enum constants don't end up
> being defined.

yes, but the define-foreign-enum defines a foreign type named
dbus:bus that converts between the symbols and the enumeration values.
so you can just pass e.g. 'dbus:session-bus to a foreign procedure
that expects a dbus:bus argument, it doesn't need to have a value as
a variable.  you can also pass '(dbus:session-bus dbus:system-bus)
and get the two values or-ed together.

afaik the dbus:bus foreign-type is only available in the same compilation
unit as the define-foreign-enum, so you need to have the foreign-lambdas
that use dbus:bus in the same file (but you can use the foreign functions
from any file)

hth&bye,
hans.


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to