[Openmcl-devel] self-contained executable library - how does it access command line arg[1]?

Didier Verna didier at lrde.epita.fr
Thu Dec 29 09:53:49 UTC 2011


"Mark H. David" <mhd at yv.org> wrote:

> I don't see any way to get the first arg to a self-contained
> executable. I find it hard to believe you cannot save an exe as "foo",
> and then have your application interpret
>
>   foo bar
>
> typed on the command line however it wants.
>
> and from trying stuff out is that you cannot get that.  You can only have it
> interpret
>
>   foo -- bar
>
> Is that true?

  No.

> Say it ain't so.

  it ain't so.


CCL has a ccl::*command-line-argument-list* variable for that. You can
access cmdline arguments after dumping an executable with something like
this:

(ccl:save-application name
	     :toplevel-function #'function
	     :init-file nil
	     :error-handler :quit
	     :prepend-kernel t)


You may be interested in my command-line options management library[1],
which provides portable cmdline manipulation and executable dumping
across several compilers, including CCL. If you're not interested in the
whole stuff, take a look at the file util.lisp.



Footnotes: 
[1]  http://www.lrde.epita.fr/~didier/software/lisp/clon.php

-- 
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com



More information about the Openmcl-devel mailing list