From: ···········@gmail.com
Subject: generating executables in common lisp
Date: 
Message-ID: <1144446249.355232.276240@u72g2000cwu.googlegroups.com>
hello,

i would like to generate an executable using some common lisp
implementation. by an executable, i mean something i can call from the
unix command line. my code is not interactive, so all i need to do is
take in command line input, calculate the answer, and report the answer
to the user. the other critical property i need is that it cannot be
possible to break out of the computation to get a lisp prompt. i don't
want users to be able to see the source code at this time.

currently i am using allegro common lisp's generate-executable feature,
but i cannot find anything in the documentation that assures me that
the user will not be able to break into the lisp prompt.

any suggestions?

-daron

From: bradb
Subject: Re: generating executables in common lisp
Date: 
Message-ID: <1144447135.491161.181880@v46g2000cwv.googlegroups.com>
You could maybe use ThinLisp
(http://sourceforge.net/projects/thinlisp/), which takes a developed
Lisp program, then distills it into C and compiles it.  ThinLisp is not
a full Lisp implementation.
Or maybe ECL.

Brad
From: Juanjo
Subject: Re: generating executables in common lisp
Date: 
Message-ID: <1144448746.508232.122400@e56g2000cwe.googlegroups.com>
···········@gmail.com schrieb:
> i would like to generate an executable using some common lisp
> implementation. by an executable, i mean something i can call from the
> unix command line. my code is not interactive, so all i need to do is
> take in command line input, calculate the answer, and report the answer
> to the user. the other critical property i need is that it cannot be
> possible to break out of the computation to get a lisp prompt. i don't
> want users to be able to see the source code at this time.

Build your program with ECL. If you compile your code, it is translated
to C and then compiled by a C compiler and linked to your program.
Users will not get the lisp source code. Besides that, ECL now provides
a reasonable interface to access command line arguments and you can
disable the debugger and intercept interupts (signals in the Unix
parlance) so as to avoid users break the computation or customize the
behavior of your program when such a thing happens.

The homepage of the project is http://common-lisp.net/project/ecl

Juanjo
From: Pascal Bourguignon
Subject: Re: generating executables in common lisp
Date: 
Message-ID: <878xqh8021.fsf@thalassa.informatimago.com>
···········@gmail.com writes:

> hello,
>
> i would like to generate an executable using some common lisp
> implementation. by an executable, i mean something i can call from the
> unix command line. my code is not interactive, so all i need to do is
> take in command line input, calculate the answer, and report the answer
> to the user. the other critical property i need is that it cannot be
> possible to break out of the computation to get a lisp prompt. i don't
> want users to be able to see the source code at this time.
>
> currently i am using allegro common lisp's generate-executable feature,
> but i cannot find anything in the documentation that assures me that
> the user will not be able to break into the lisp prompt.
>
> any suggestions?

Use clisp EXT:SAVEINITMEM with the :EXECUTABLE flag.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

Pour moi, la grande question n'a jamais �t�: �Qui suis-je? O� vais-je?� 
comme l'a formul� si adroitement notre ami Pascal, mais plut�t: 
�Comment vais-je m'en tirer?� -- Jean Yanne
From: Timofei Shatrov
Subject: Re: generating executables in common lisp
Date: 
Message-ID: <443756e5.2091116@news.readfreenews.net>
On 7 Apr 2006 14:44:09 -0700, ···········@gmail.com tried to confuse
everyone with this message:

>hello,
>
>i would like to generate an executable using some common lisp
>implementation. by an executable, i mean something i can call from the
>unix command line. my code is not interactive, so all i need to do is
>take in command line input, calculate the answer, and report the answer
>to the user. the other critical property i need is that it cannot be
>possible to break out of the computation to get a lisp prompt. i don't
>want users to be able to see the source code at this time.
>
>currently i am using allegro common lisp's generate-executable feature,
>but i cannot find anything in the documentation that assures me that
>the user will not be able to break into the lisp prompt.
>
>any suggestions?
>

The other people who replied didn't answer your main question: how to
disable debugger breaking into the REPL. There are several methods. You
can use 

(defun main ()
  (ignore-errors
     ...your stuff here...)

This would make every-error producing form to return NIL instead. This
may lead to your program doing all sorts of weird stuff. It's better to
quickly abort execution until something worse happens.

(defun main ()
  (handler-case
     (progn
        ...your stuff here...)
    (error (error)
       (format t "Fatal error: ~a. Aborting execution." error)
       (ext:quit)))) ;;Or whatever command quits Lisp in your
implementation

It may be hard to debug your program with this wrapper attached, so
create main2 function without handler-case and use it for testing.

-- 
|WAR HAS NEVER SOLVED ANYTHING|,----- Timofei Shatrov aka Grue---------.
|(except for ending slavery,  ||mail: grue at mail.ru ================ |
|   fascism and communism)    ||============= http://grue3.tripod.com  |
|...and Saddam's dictatorship |`----------------------------------[4*72]
From: Paolo Amoroso
Subject: Re: generating executables in common lisp
Date: 
Message-ID: <878xqg311c.fsf@plato.moon.paoloamoroso.it>
···········@gmail.com writes:

> i would like to generate an executable using some common lisp
> implementation. by an executable, i mean something i can call from the
> unix command line. my code is not interactive, so all i need to do is

With SBCL you can use EXT:SAVE-LISP-AND-DIE with the :EXECUTABLE
argument.  See:

  http://www.sbcl.org/manual/Saving-a-Core-Image.html


Paolo
-- 
Why Lisp? http://wiki.alu.org/RtL%20Highlight%20Film
The Common Lisp Directory: http://www.cl-user.net