[comp.sys.next] why random

sthou@athena.mit.edu (Stewart T. Hou) (06/24/91)

First of all I want to thank Yonezawa for porting AKCL to NeXT.
It compiles fast!

I have a C routine which I call from LISP using the KCL C/LISP
interface.
It works on a Sun, but on my NeXTstation I found random() and srandom()
don't work (using the compiler that comes with the port).

The problem is illustrated below.  Could someone suggest something to
make it work?

(defentry c-random-num
  ()
  (void foo_func))

(Clines
%
% foo_func()
% {
%   printf("random() doesn't work...\n");
%
%   printf("%d\n", random());
%
%   printf("done\n");
% }
%
)

Here's what happens when the compiled code is executed:

NEURAL>(c-random-num)
random() doesn't work...

Error: NIL is not a VECTOR
Error signalled by C-RANDOM-NUM.
Broken at C-RANDOM-NUM.  Type :H for Help.
NEURAL>>

I am using
AKCL (Austin Kyoto Common Lisp)  Version(1.530) Sun Jun 16 16:48:31 CDT
1991
Contains Enhancements by W. Schelter; NeXT Version(1.01) by N. Yonezawa

and the compiler command was
/usr/local/lib/kcl/kcl-cc -DVOL=volatile -fwritable-strings  -c -I.
my-code.c -w

Both random() and srandom() are recognized in the program because there
was 
no messages like "undefined _random symbol" when the object code is
loaded,
as shown below

NEURAL>(load "my-code.o")
Loading my-code.o
start address -T 283000 Finished loading my-code.o
176

Thanks for inputs.

Stewart

--
  --Stewart T. Hou  <sthou@athena.mit.edu>

yonezawa@m.cs.uiuc.edu (Noritake Yonezawa) (06/25/91)

sthou@athena.mit.edu (Stewart T. Hou) writes:

>I have a C routine which I call from LISP using the KCL C/LISP
>interface.
>It works on a Sun, but on my NeXTstation I found random() and srandom()
>don't work (using the compiler that comes with the port).

I tried your example on a SPARC, and then got same error messages.
So, I don't think it's a AKCL/NeXT-specific problem.

--
Noritake Yonezawa [yonezawa@cs.uiuc.edu]
Department of Computer Science
University of Illinois at Urbana-Champaign