Welcome to the CHICKEN Scheme pasting service
this one added by rovar on Sun Mar 18 22:38:08 2012
;; create the errmsg ptr that is passed to most leveldb operations (define-location (errmsg c-string)) ((foreign-lambda void ((c-string val)) "val = NULL;") (location errmsg)) (define (leveldb-open) (let ((leveldb* ((foreign-lambda (c-pointer (struct "leveldb_t"));; The return type of the C function we're binding: leveldb_open ;; The name of the C function we're binding: (c-pointer (struct "leveldb_options_t")) ;; param 1 c-string ;; param 2 errmsg )))) (if leveldb* (set-finalizer! (make-leveldb leveldb*) leveldb-close) (error errmsg))))