3

I am dumping a new interpreter written in CL with SBCL, and need to determine the location of the binary (executable sbcl dump) to set up some search path. Is there a way to find out how? I tried *core-pathname* but it seems not to be defined in executable dumps.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
Norbert Preining
  • 237
  • 1
  • 11
  • When I looked at the docs, \*core-pathname* is what I found in http://www.sbcl.org/1.0/manual/Saving-a-Core-Image.html, so at first I wondered if you ran into a bug, but it seems like it'd be a hard one to miss. Then, noticing that you mentioned executable dumps, I wonder if you just have to do the same sort of thing that other applications do, and there's not a universal answer. (E.g., see [Get path of executable](http://stackoverflow.com/q/1528298/1281433).) – Joshua Taylor Oct 28 '14 at 12:28
  • Also [How to find path from where current process/executable is running?](http://stackoverflow.com/q/661161/1281433) which says to look at argv[0]. In SBCL you can do that with \*posix-argv*; see [2.4.4.1 Unix-style Command Line Protocol](http://www.sbcl.org/1.0/manual/Unix_002dstyle-Command-Line-Protocol.html). – Joshua Taylor Oct 28 '14 at 12:31
  • If you want to be portable with other implementations, you might have a look at the [Accessing the command line arguments](http://cl-cookbook.sourceforge.net/os.html#accessing-command-line) section from the Common Lisp Cookbook. – Joshua Taylor Oct 28 '14 at 12:33

1 Answers1

3

Ok, after some digging I think I found the answer myself! It is:

sb-ext:*core-pathname*

which works! Strange that this is not mentioned in the SBCL manual.

Norbert Preining
  • 237
  • 1
  • 11