[plt-scheme] Questions about modules, compilation, namespaces, planet and ffi

From: Bruno Deferrari (utizoc at gmail.com)
Date: Thu Apr 28 22:49:06 EDT 2005

  Ok, thanks for your replys, they helped a lot.

  This is what I made for the list, is it right?? (at least, it seems to work)
;====================================
; Make a list, and free the array
(define-fun-syntax _list/free
  (syntax-id-rules ()
    [(_ t c) (type: _pointer
              pre: (malloc c t)
              post: (x => (begin0
                            (cblock->list x t c)
                            (free x))))]))

; Original C function prototype
; char    **eet_list  (Eet_File *ef, char *glob, int *count_ret);
; And here I use _list/free
(defeet* eet-list : _EetFile _string (o_count : (_ptr o _sint))
		    -> (_list/free _string o_count))
;====================================

  Now, what about strings?? they also should be freed right??
  Would this work?? (As the previous one, it seems to work)

; Make a string/utf-8, and free the char* pointer
(define-fun-syntax _string/utf-8/free
  (syntax-id-rules ()
    [_ (type: _bytes
        post: (x => (begin0
                      (bytes->string/utf-8 x)
		      (free x))))]))

  Well, I have another problem with syntax-case, modules and
  current-continuation-marks , but I'm going to re-read all the
  documentation I have, and see if I can solve it myself.

Have fun ;)



Posted on the users mailing list.