[fpc-devel] CreateGUID implementation attached

Michael Van Canneyt michael at freepascal.org
Thu May 19 19:08:05 CEST 2005



On Thu, 19 May 2005, Danny Milosavljevic wrote:

> Hi,
> 
> attached you find a CreateGUID implementation that creates (time-based)
> guids. These follow a low-high approach, with a random part and a time
> part.
> 
> If available, uses libuuid.so.1 and /dev/urandom. Otherwhise uses manual
> implementation (which sucks - just test by while true ;
> do ./createguid ; done and behold all the equal guids) as a fallback.
> 
> The function should be pretty usable *if* libuuid.so.1 is available, and
> pretty dangerous if not. I'll not be improving the fallback further
> though. Someone wants to step in?

You're a bit too late, unfortunately. I have a native object pascal CreateGUID 
function ready. It mimics libuuid on Linux (uses mac address and time), and 
uses native windows calls on Win32. For other platforms it uses simply random 
numbers if no 'real' implementation is available.

I was just waiting for 2.0 to settle down to check it in.

I will do so shortly, so if you're patient, you'll see it appear quite soon.

Michael.




More information about the fpc-devel mailing list