Lisp HUG Maillist Archive

Init file commands crashing

I have set up an initialization file (.lispworks) so I can have LW execute some commands I am constantly typing in after it launches.

There are two commands I always use after loading and compiling my project file:

(in-package..)
(start-my-code)

If I load and compile my project file then type those two commands in the listener everything is fine.

If I instead put a (compile-if-needed "myfile" :load t) in the init file followed by the two commands above I get a crash into my command line:

"/tmp/LWtemp.MYCOMPUTERNAME.local.235.0.command; exit
my-routine.nfasl
;Loading fasl file /Users/MYUSERNAME/myproject/myfilename.fasl
;Loading fasl file /Users/MYUSERNAME/myproject/abotherfilename.fasl
etc

ERROR: Bad arguments to MYROUTINENAME: NIL NIL"

So my questions is, what's different about putting the commands in the init file?  Or is there a difference I need to know about between (compile-file-if-needed) and the process of opening the project file and clicking the compile button?

I tried this using the model init file and adding the commands at the end and also with an init file that only has these commands.

Thanks for any help on this.


Re: Init file commands crashing

Depending on what START-MY-CODE actually does, and when you want it  
done, you may want to lookup EVAL-WHEN.  If you want START-MY-CODE to  
be called only when loading, you may need to do something like

(eval-when (:load-toplevel)
   (start-my-code))

HTH.

-Klaus.


On 07/02/2008, at 12:45, Thomas Summerall wrote:

>
> I have set up an initialization file (.lispworks) so I can have LW  
> execute some commands I am constantly typing in after it launches.
>
> There are two commands I always use after loading and compiling my  
> project file:
>
> (in-package..)
> (start-my-code)
>
> If I load and compile my project file then type those two commands  
> in the listener everything is fine.
>
> If I instead put a (compile-if-needed "myfile" :load t) in the init  
> file followed by the two commands above I get a crash into my  
> command line:
>
> "/tmp/LWtemp.MYCOMPUTERNAME.local.235.0.command; exit
> my-routine.nfasl
> ;Loading fasl file /Users/MYUSERNAME/myproject/myfilename.fasl
> ;Loading fasl file /Users/MYUSERNAME/myproject/abotherfilename.fasl
> etc
>
> ERROR: Bad arguments to MYROUTINENAME: NIL NIL"
>
> So my questions is, what's different about putting the commands in  
> the init file?  Or is there a difference I need to know about  
> between (compile-file-if-needed) and the process of opening the  
> project file and clicking the compile button?
>
> I tried this using the model init file and adding the commands at  
> the end and also with an init file that only has these commands.
>
> Thanks for any help on this.
>


Updated at: 2020-12-10 08:44 UTC