[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: execute* in MzScheme v199 + loading mzc-compiled files



Quoting Riku Saikkonen:
> >   The `execute' and `execute*' procedures were eliminated entirely.
> 
> Was there a reason for taking out `execute*'?

It was a source of substantial complexity, especially dealing with
multiple platforms, and it seemed like no one used it.

> Another thing: I tried using the new foreign-function interface to
> call the Unix execl(2) function in place of execute*

That sounds like a good idea...

> ,----
> | rjs@lambda:~/t$ /usr/local/lib/plt.v199/bin/mzscheme 
> | Welcome to MzScheme version 199.19, Copyright (c) 1995-2001 PLT
> | > (load/use-compiled "restart.scm") 
> | > (exec "/bin/ls")
> | c-lambda-procedure: c-lambda expression not compiled by mzc
> | > (system-library-subpath)
> | "i386-linux"
> | > 
> `----

Bug in mzc's optimizer: it's not paying attention to the c-lambda
annotation, so it changes

 ((c-lambda (formal-arg ...) ...body...)
  actual-arg ...)

to just

  ...body...

I'll fix that. 

Meanwhile, you can work around the problem with something like:

 (c-declare "#include <unistd.h>")
 (define execl
   (c-lambda (char-string char-string char-string) void "execl"))
 (define (exec program)
   (execl
    program
    program
    #f))

(Note: I had to add a #f argument, otherwise it didn't work for me.)

Matthew