[plt-scheme] Re: Generating C code

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Fri May 15 08:20:08 EDT 2009

Paulo J. Matos wrote at 05/15/2009 07:53 AM:
> (gcc print-source)	
>
> What is print-source? It says, it invokes print-source, but without
> being able to search the docs online or having a link, can't really
> understand exactly what gcc receives.
>   

If you install the PLaneT package, you can search the docs in your Web 
browser from the local copy of the package.

In answer to your question "print-source" appears to be just a thunk 
that writes the desired C code to current-output.  For example:

#lang scheme
(require (planet dherman/c:3:1/eval))
(let-values (((stdin stdout)
              (gcc (lambda ()
                     (display "#include <stdio.h>\n")
                     (display "int main(int argc, char **argv) {\n")
                     (display "  (void)printf(\"(hello world)\");\n")
                     (display "}\n")))))
  (read stdin))
;; ==> (hello world)

One thing to note: it looks like currently you cannot supply custom 
command-line arguments to the "gcc" program using this "gcc" procedure.

-- 
http://www.neilvandyke.org/


Posted on the users mailing list.