Am 31.10.2005, 21:32 Uhr, schrieb Peter BARABAS <[EMAIL PROTECTED]>:

[...]
B.)

(define-foreign-type dbtype int)
(define-foreign-variable db:unknown dbtype DB_UNKNOWN (->string DB_UNKNOWN))
(define db:unknown DB_UNKOWN)

Here the Scheme variable gets its value from the C variable DB_UNKNOWN

This approach has more abstraction (though it can be even more
abstract with a simple macro) and is more resistant to changes in the
C library. Does it have any disadvantages? This second method seems a
bit better for me.
[...]

As is often the case with higher abstraction, it causes more overhead on the
low level side. Everytime you acces the variable in example B, machine data
has to wrapped into or unwrapped from scheme data types -- with the int type in CHICKEN this should not cause noticeable performance losses, but with, for
example, double variables it would.

cu,
Thomas Chust


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

Reply via email to