This is the crux of it. $ cat testevict.scm (use lolevel)
(define (myalloc size) (printf "Requested ~S byte\n" size) (let ((obj (allocate size))) (printf "~S\n" obj) obj)) (define getmem (foreign-lambda* void ((c-string ptr)) "printf (\"ptr = %p\\n\", ptr);")) (define s "A string") (define e (object-evict s myalloc)) (getmem e) $ Notice that I'm using the optional second parameter to object-evict so that I can print out the allocated pointer address. When compiled and run I'd expect this program to show that the pointer received by getmem is very close to the pointer returned by allocate (just the same plus the size of the header used to describe the object to Scheme, basically). Instead I get completely different values. $ csc testevict.scm $ ./testevict Requested 12 byte #<pointer 0x806b488> ptr = 0xbfec0864 $ My expectations are obviously wrong. What's happening there? _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
