Is there any way to get the actual srandom/random functions from stdlib.h
over to the mingw32 environment? .. using rand/srand did not work as I had
hoped, it let me compile, but it's acting very strangely .. it compiles fine
under cygnus, but I don't want to have to use the cygnus1.dll .. if I use
the compiler switch -mno-cygnus, I get the undefined reference errors again
From: Tor Lillqvist <tml@ik...> - 2001-01-01 14:02:42
> Is there any way to get the actual srandom/random functions from stdlib.h
> over to the mingw32 environment?
Umm, those shouldn't be in stdlib.h as they aren't "std" AFAIK.
Modify a bit for mingw compilation (replace u_int with unsigned int,
ssize_t with int, remove the srandomdev() function which is
meaningless on Windows).
From: Kai Ruottu <kai.ruottu@lu...> - 2001-01-01 22:05:49
Tor Lillqvist wrote:
> lonnie@... writes:
> > Is there any way to get the actual srandom/random functions from stdlib.h
> > over to the mingw32 environment?
> Umm, those shouldn't be in stdlib.h as they aren't "std" AFAIK.
GCC's habit now is to include the GNU libiberty with the GCC sources. The
'libiberty'-library tries to include all the useful 'missing' functions and
should be the 1st to look at if needing anything which doesn't exist in the
standard C-library, normally 'libc.a', but 'libcrtdll.a' or 'libmsvcrt.a' in
the Mingw-case. Perhaps the 'libiberty.a' is missing from the official
distributions (why ?), but every GCC-builder should get it now (since egcs-1.0)
after a successful GCC build, so :
E:\usr\local\lib\gcc-lib\i386-mingw32msvc\2.95.2>nm libiberty.a | grep rand
000000d0 d _rand_deg
000000d4 d _rand_sep
000000cc d _rand_type
000002cc T _random
00000040 d _randtbl
00000000 T _srandom
Just adding a '-liberty' into the compile/link command will link also against
the 'libiberty.a'. Whether the functions work as expected is then another