[fpc-devel] Weird output from fpGetErrNo

Marco van de Voort marcov at stack.nl
Wed Jan 30 21:52:13 CET 2013


In our previous episode, Ewald said:
> fpgetcerrno from initc gives me the correct results as well; and by
> looking at the code I see it implements it by using `__errno_location`
> under linux, so no surprise there.

Well, the surprise is that initc worked, and yours not. From a quick glance
I believe it to be correct too.
 
> So, what's supposed to be the difference between fpgetcerrno and
> fpgeterrno (multithreading? [*])?

Platform dependent. They can be the same. FPC does its own kernel calls on
some platforms, and the result is then stored in fperrno.

fpcerrno is always linking to libc's errno.

On platforms where FPC uses libc to acces the kernel, errno=cerrno.


> [*] Maybe not important, but this is a rather heavily multi-threaded
> application.

Both are threadsafe, even if you use the pseudo variable variant.



More information about the fpc-devel mailing list