Re: GUID on Linux
From: Jake Waskett (chilliesmad_at_hotmail.com)
Date: Sat, 13 Mar 2004 23:24:42 +0000
Armel Asselin wrote:
> I have another question now: should I use "libuuid" (or a port of it) on
> Windows too ? or will the GUID of Windows CoCreateGuid and those of
> "libuuid" be "compatible" enough so that I am sure that they won't
> generate colliding IDs ?
Well a UUID is a UUID. They both implement the DCE specification, so you
shouldn't get a collision. If I were you, I'd use CoCreateGuid on Windows
and libuuid on Linux, but write your own little abstraction layer to hide
There is of course a remote chance of a collision anyway, but it's
sufficiently improbable that you shouldn't need to worry about it.
Reading elsewhere in this thread, what you need to do to GUARANTEE
uniqueness is the following: combine a unique machine identifier (such as
ethernet address, assigned as a configuration setting, etc) and a
locally-generated sequence number (32 or 64 bits should do it). You should
be able to get the database you're using to generate the sequence number
> "Jake Waskett" <firstname.lastname@example.org> a écrit dans le message de
>> Armel Asselin wrote:
>> > Hello,
>> > I am searching a function on Linux (C/C++) which actually generates a
>> > globally unique identifier (GUID) as CoCreateGuid does on Windows ???
>> > Thx,
>> > Armel
>> Try "man libuuid", part of e2fsprogs. It should do what you need I think.