[Ecls-list] load-pathname in .o processing

Juan Jose Garcia-Ripoll jjgarcia at users.sourceforge.net
Sat Oct 21 15:47:41 UTC 2006


2006/10/21, Rick Taube <taube at uiuc.edu>:
> i think its a problem that standalone apps seem to process .o files
> sort of like lisp loading but without lisp globals in effect. so lisp
> programs will break if they depend on *load-truename* etc when they
> are loaded. you can see what i mean using this example:

Let's be more precise. The problem is that you have compiled multiple
files and combined them into a standalone program. Now, when the
program is executed, since you have not invoked LOAD, the value of
*LOAD-TRUENAME* is unset.

There is no universal solution for this and the fix is definitely not
to force ECL setting *LOAD-TRUENAME* because there is no single value
that would satisfy all applications around: for instance some would
expect the name of the FAS file (which does no longer exist).

So the solution seems rather problem dependent and customized to what
your program expects: what does it need the pathname for? If the
pathname is not used at all, you can simply assign it any value within
a compiled file which comes before all other files which need this
value. For instance, create preloa.lisp

(setq *load-truename* (merge-pathname "foo" (si:getcwd)))

compile and incorporate it

(c:build-program "loa-app" :lisp-files '("preloa.o" "loa.o") :epilogue-code
'(print (list :here-> *here*)))

What pathname you put in *load-truename* is your business. A
possibility is to locate your program in the filesystem, or to use a
global environment variable, or simply use a void value as in
preloa.lisp, if you know it is not going to be used.

Juanjo




More information about the ecl-devel mailing list