[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

5046.0. "DICE and rand/srand problem" by WOTVAX::HATTOS (I think, Therefore I'm paid less) Mon Sep 16 1991 10:18

    I have a problem with DICE 2.06. I am trying as part of a little
    project to generate some random numbers. Below is a code fragment, its
    pretty standard stuff really. My problem is that DICE wont link this.
    
    It compiles ok into an assembler file, and then into an object file,
    but when it links I get the errors
    
    Undefined variable _srand ....
    Undefined variable _rand  ....
    
    I am using the command 
    
    	dcc rand.c -o rand
    
    The include files are in the include directory and DINCLUDE: is
    assigned to this directory. Can someone please tell me what is going on
    here?
    
    Could someone try this out, if any one else is using DICE.
    
    Here is the code fragment.....
    
    
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

main()
{
	int i, utime;
	long ltime;

	ltime=time(NULL);
	utime=(unsigned int) ltime/2;
	srand(utime);
	for(i=0;i<10;i++) printf("$d ", rand());
}

    
    I have proved the time bit works, it just doesn't seem to be able to
    find the srand and rand functions.
    
    Grateful for any help, even a different way of generating random
    numbers !
    
    Stuart
T.RTitleUserPersonal
Name
DateLines
5046.1libraries?STAR::GUINEAUbut what was the question?Mon Sep 16 1991 11:574
Does DICE automatically link against the appropriate libraries? You may need
to link against some library where the rand functions are located.

john
5046.2It works for meMAS::SORGEMon Sep 16 1991 21:129
    I was able to compile and run your code with no problem. ( Actually I
    had to change the $ to a % in the printf statement). I'am running DICE
    version 2.06.33, this is a registered version. If you have a public
    domain version there are some features that are unavailable ( float
    data types is one that I know of ) this may be your problem
    
    					Regards
    
    					    Glenn
5046.3Is rand an ANSI function.WOTVAX::HATTOSI think, Therefore I&#039;m paid lessTue Sep 17 1991 04:3810
    Glenn, whoops.... typo on the VAX the original code does have a %.
    
    Surely if it is because of the version being un-registered, this is not
    what you would expect... I thought Matt had included all ANSI C
    functions.
    
    I am registering anyway, so I will have to wait and see!
    
    Thanks,
    Stuart
5046.4Help, File requestor wanted on DME.ULTRA::BURGESSMad Man across the waterWed Nov 06 1991 11:1410
	This seems to be the only topic on DICE, though my question 
has nothing to do with rand/srand.

	Has anyone connected a file requestor to DME ? 

	Which one and how ?   

	Reg

5046.5TENAYA::MWMWed Nov 06 1991 15:2910
I haven't done it for DME, but I did it for mg. If the DME Rexx port
has an "edit file" command of some kind, all you do is write a (very)
short Rexx script that invokes the RexxArpLib file requester, checks
that the user didn't cancel, then issues the "edit file" command. You then
bind that to whatever keystrokes you want in DME.

The RexxArpLib requester is the ASL file requester with ADOS 2.0
and RexxArpLib 1.30 (I think), or the ARP file requester otherwise.

	<mike