load problem

Discussion of Common Lisp

load problem

Postby nico92 » Sat Mar 17, 2012 2:48 am

I have a problem with the load and require functions.
If the directory dir2 is in the dir1 directory, and if in the dir2 directory, I have two files: file1.lisp and file2.lisp, and if I put (load "file2.lisp") in file1.lisp:
If I run from dir1: clisp dir2/file1.lisp, then I get an error.
It is the same if I use require instead of load.
How can I fix it?

In other words, I have a program made of several files, with one which loads the others. I would like not to have to run this one from the directory where it is.
Posts: 1
Joined: Sat Mar 17, 2012 2:31 am

Re: load problem

Postby Ramarren » Sat Mar 17, 2012 6:28 am

The proper way is to use a system definition facility like ASDF. Otherwise you have to use MERGE-PATHNAMES to create a full pathname to the file you want to load, either by using saved absolute path or *LOAD-PATHNAME* variable. But that might break if anything is file-compiled.
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Return to Common Lisp

Who is online

Users browsing this forum: Bing [Bot] and 3 guests