[Openmcl-devel] executable problem

R. Matthew Emerson rme at clozure.com
Tue Dec 27 08:18:57 PST 2011


On Dec 27, 2011, at 11:06 AM, Haris Bogdanovich wrote:

> I created a program for creating sudoku problems
> in html table and it works as expected when top level function
> is called from Emacs, always creates a new table.
> I created executable program with:
>  (save-application "c:/sudoku.exe" :toplevel-function #'start :prepend-kernel t)
> and when called sudoku.exe it always returns the same table,
> like the #'start function is called once upon creation and that's it.
> So I made a test program like this:
> (defun start ()
>     (print (random 10)))
> When called from Emacs it works ok.
> I created executable with:
>  (save-application "c:/test.exe" :toplevel-function #'start :prepend-kernel t)
> and when called from dos prompt it always returns the same number
> again like function #'statrt is called once upon creation of executable.
> Where is the problem ?

In CCL, a thread's initial random state is always the same.  Each thread
has its own private *random-state*.

You can set or bind *random-state* as desired.  Use (make-random-state t)
to generate a randomly initialized random state object.

(defun start ()
  (let ((*random-state* (make-random-state t)))
    (print (random 10))))




More information about the Openmcl-devel mailing list