I feel like GUID/UUID questions have been done to death here, but I can't seem to find quite what I'm looking for. I need a function that will generate V4 GUIDs in C, i.e. something that is essentially compatibile with Guid.NewGuid from C#.
This has to work on Windows (XP, Server 2003/8, etc) and 3 different distros of Unix (AIX, Sun, and HP).
I've seen some of the specification white papers, some that even have some sample implementations, but there always seems to be an issue with proper random numbers, or they only generate V1 or V3 UUIDs, etc. The wikipedia page for UUIDs pointed me at a couple of sample libraries, but these are WAY too heavy weight for what I'm trying to accomplish here.
I feel pretty strongly that I could implement something myself, but don't want to waste time reinventing the wheel if there is something really simple and lightweight I could just drop in. Anybody have something or know of something?
Thanks.