Jeronimo Pellegrini scripsit: > define-external cannot be used for recursive definitions (probably > supposed to be used only for wrappers -- is this correct?) > My recursive define-external functions segfaulted; non-recursive > ones didn't.
The real issue isn't recursion, it's stack consumption. C recursion consumes stack, and when Chicken calls C only a small amount of stack is guaranteed to be available, because of the way Scheme code uses the C stack (steadily consuming it and then dropping almost all of it at each minor GC). If you want, you can call (gc #f) to force a minor collection before calling your C routine, but of course that takes time. You also need to be careful of concurrency: if multiple threads are trying to play that game, they are very likely to collide, since all Chicken threads share the C stack. -- John Cowan <[email protected]> http://ccil.org/~cowan Micropayment advocates mistakenly believe that efficient allocation of resources is the purpose of markets. Efficiency is a byproduct of market systems, not their goal. The reasons markets work are not because users have embraced efficiency but because markets are the best place to allow users to maximize their preferences, and very often their preferences are not for conservation of cheap resources. --Clay Shirkey _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
