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

From: Bruno Deferrari (utizoc at gmail.com)
Date: Wed Apr 27 23:11:42 EDT 2005

First of all, I want to say that plt-scheme is great, I'm totally obsessed
with it, it was one of the main reasons my chooice was Scheme instead of
Common Lisp.

Now, I have some questions:

* The question about PLaneT:
  Is there a way to download the packages at planet.plt-scheme.org without
  using require?? because I don't have access to internet at home.
  I can download them from a cybercafe, but I don't know where they are.

* The first question about ffi:
  On the (_fun ...) syntax, the (:post ...) goes before the second -> ,
  or after it?? (my guess is that it goes before)

* The second question about the ffi:
  I started playing with the new ffi (Im trying to interface mzscheme with
  the EFL (www.enlightenment.org), but I'm confused about something.
  Here, for example:

; Original C function prototype
; char    **eet_list  (Eet_File *ef, char *glob, int *count_ret);

; Scheme ffi declaration (defeet is similar to defxmms from "xmmsctrl.ss")
(defeet eet-list : _EetFile _string (r_count : (_ptr o _sint))
		   -> (r_ret : (_list o _string r_count)))

  Here, the array of strings should be freed, but the string pointers it
  contains shouldn't.
  How does the ffi know what to do???, or how do I specify it???

* The question about modules, compilation and namespaces:
  
  I'm using plt-299.100 , some days ago, I downloaded mreddesigner
  (http://mreddesigner.lozi.org), and after fixing it, so it works on 299.100
  I compiled the files to .zos, but now, it doesn't work right.
  (it works fine, if I don't compile it)
  To run it, i do "mred -r main.scm", where main.scm is:

(require (lib "mred.ss" "mred")
	 ;...otherlibs...
	 )

(require "mreddesigner.ss") ; This starts mreddesigner

  And "mreddesigner.ss" looks like this:

(module mreddesigner mzscheme
  (load/use-compiled "some-file.ss")
  ; ... more files
)

  I runs fine, but when I try to do something, I get
  "reference to undefined identifier <some-identifier>" where <some-identifier>
  Is something imported from a module on main.scm.
  The compile.scm file had a line like this for every .ss file:

  (require (lib "compile.ss"))
  
  (compile-file "somefile.ss")
  ; .. more files

  And I used "mred -r compile.scm" to run it. Later (after reading about
  namespaces, compilation, etc) I modified it, and now it looks like this:

(require (lib "compiler.ss" "compiler"))

((compile-zos '(require (lib "mred.ss" "mred")
		       ;... the rest of the libs
	       )
  '("mreddesigner.ss"
    ;... the rest of the files
   )) 'auto)

  but I get this error:
  
dynamic-require: unknown module: #%mred-kernel; need to run in MrEd
instead of MzScheme
  
  I'm running it like this "mred -r compile.scm".

  What am I doing wrong??

  
Well, thats all (well, all I can remember now ;) )



Posted on the users mailing list.