[racket] Program compiles with racket fails when invoked with execl()

From: bbi5291 (bbi5291 at gmail.com)
Date: Fri Sep 17 15:31:25 EDT 2010

Thanks for the tip Eli, that seems like what I'm looking for. I can't
actually figure out how to use it for files though; when I write
--------------------
(make-evaluator 'racket (string->path "aplusb.scm"))
--------------------
I get the error message
--------------------
open-input-file: `read' access denied for aplusb.scm"
--------------------
even though I definitely have read access to this file.
If I try
--------------------
(define aplusb (open-input-file "aplusb.scm"))
(make-evaluator 'racket aplusb)
--------------------
then the error message is
--------------------
exception raised by error display handler: directory-exists?: `exists'
access denied for /; original exception raised: module: illegal use (not at
top-level)
--------------------
It works fine when I give the second argument as a string or an s-expression
but that wouldn't work well for the intended application.

Have I misunderstood the documentation?

On Fri, Sep 17, 2010 at 4:32 AM, bbi5291 <bbi5291 at gmail.com> wrote:

> Consider the simple Racket program
>
> --------------------
> #lang racket
> (+ (read) (read))
> --------------------
>
> When this is compiled using raco, the executable produced works exactly as
> intended, reading two integers on standard input and printing their sum.
> However, when I run the C program
>
> --------------------
> #include <unistd.h>
> int main()
> {
>         execl("aplusb","aplusb",(char*)0);
> }
> --------------------
>
> where "aplusb" is the name of the Racket program, it exits immediately with
> the errors:
>
> --------------------
> with-input-from-file: expects type <path or string> as 1st argument, given:
> #f; other arguments were: #<procedure>
>
>  === context ===
> embedded-load
>
> --------------------
>
> How can I fix this problem? I am using Racket v5.0.1 on Ubuntu 9.10 (i386).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100917/4d5c329d/attachment.html>

Posted on the users mailing list.