Re: [fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-09 Thread Sven Barth
On 09.02.2013 01:04, Graeme Geldenhuys wrote: On 2013-02-08 17:08, Ewald wrote: {$macro on} {$define Debug_ThreadSelf:= ptruint(GetCurrentThreadID)} I must confess I haven't used macros in FPC. Also the code I'm working with is cross platform and cross compiler. I don't know if

[fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-08 Thread Graeme Geldenhuys
Hi, Under Linux and Windows I have the following code which works fine. var LThreadID: string; begin FmtStr(LThreadID, '%.4d', [GetCurrentThreadID]); Under FreeBSD (64-bit) that failed with a EConvertError in the unit tests and the compiler gave a message of 'Invalid argument index in

Re: [fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-08 Thread Ewald
Hello, I had the exact same issue when writing debug info in my code. Easy to solve I think. Just define a macro at the top of the unit like this: {$macro on} {$define Debug_ThreadSelf:= ptruint(GetCurrentThreadID)} And then change all FmtStr lines to something like

Re: [fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-08 Thread Sven Barth
Am 08.02.2013 18:09 schrieb Ewald ew...@yellowcouch.org: It can be that `ptruint` is defined in `unixtype`, but I don't know for sure. PtrUInt (and PtrInt) are declared in unit System. Regards, Sven ___ fpc-pascal maillist -

Re: [fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-08 Thread Marco van de Voort
In our previous episode, Graeme Geldenhuys said: Under Linux and Windows I have the following code which works fine. var LThreadID: string; begin FmtStr(LThreadID, '%.4d', [GetCurrentThreadID]); Threadids are probably opague under Posix. So while it works, it is not correct on Linux.

Re: [fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-08 Thread Graeme Geldenhuys
On 2013-02-08 20:34, Marco van de Voort wrote: Navigating the code to see how TThreadID is defined, I found this for FreeBSD. TThreadRec = record end; TThreadID = ^TThreadRec; So TThreadID is just a pointer to a record structure This is a common construct to define opague types.

Re: [fpc-pascal] GetCurrentThreadID under FreeBSD vs Linux

2013-02-08 Thread Graeme Geldenhuys
On 2013-02-08 17:08, Ewald wrote: {$macro on} {$define Debug_ThreadSelf:= ptruint(GetCurrentThreadID)} I must confess I haven't used macros in FPC. Also the code I'm working with is cross platform and cross compiler. I don't know if Delphi supports such macros. Quick search in Delphi 7