[fpc-pascal] CreateGUID() [was Re: GUID code]
Michael Van Canneyt
michael at freepascal.org
Sat May 21 15:01:33 CEST 2005
On Sat, 21 May 2005, listmember wrote:
> Michael Van Canneyt wrote:
> > It's in SubVersion. 2 demo units are in packages/extra/uuid, with
> > testprograms.
> It looks OK to me, except that it may be a little more optimized
> for speed since GUIDs are CPU-expensive to begin with.
Feel free to submit patches and a testprogram to prove that your
implementation is significantly faster :-)
> A couple of questions, wrt FPC v2.x:
> -- Is Int64 supported in all platforms?
> -- Is there a Int128 or something like it?
> When Windows was 32bit, Delphi had Int64; it's only natural
> that now we should have Int128 :-)
> -- GUID unit being in extra/uuid/, does it mean it will not
> be available in, say, Windows since Windows has a native
> call for that.
> Personally, I'd like 'OnCreateGUID : TCreateGUIDFunc = Nil;
> to be available in all platforms.
It is, sysutils is cross-platform.
On windows the default implementation calls CoCreateGUID,
but with OnCreateGUID you can override this behaviour.
On Linux, the default behaviour is to use the kernel
/proc/sys/kernel/random/uuid file, and fall back.
On BSD, /dev/urandom is used to generate a random GUID
on all other platforms, the system unit random() function
On all platforms, the default behaviour can be changed using
the OnCreateGUID event.
More information about the fpc-pascal