[lazarus] Libc.ErrNo and TControl.DoMouseWheel

Den Jean den.jean at pandora.be
Wed Dec 31 09:23:45 EST 2003


Hi,

Libc.ErrNo:

thanks alot for the very quick response.
I see the change in the new fpc cvs.

1) But lazarus won't run anymore if compiled
with this fpc. It stalls at startup.
If however I compile it with 
fpc-1.9.1-031129.i386.rpm, it works fine. 

2) I also tried compiling fpc with a 
{$define LIBC_OLDERRNO} added at the top of
unit libc. 
But then fpc does not compile :
ppc386 -XX -CX -Xs -OG2p3 -n -Fu/other/storage/rpms/lazarus/cvs/fpc/rtl/linux 
-Fl/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1 -Fl/usr/X11R6/lib 
-Fl/usr/lib/qt3/lib -di386 -dRELEASE libc.pp
errno.inc(4,16) Error: overloaded identifier "errno" isn't a function
libc.pp(255) Fatal: There were 1 errors compiling module, stopping


kind regards and CU next year

Den Jean

On Wednesday 31 December 2003 07:57 am, Michael.VanCanneyt at wisa.be wrote:
> On Wed, 31 Dec 2003, Marc Weustink wrote:
> > At 08:29 31-12-2003, Den Jean wrote:
> > >Hi,
> > >
> > >I am porting code from Kylix to Lazarus
> > >and I have a few questions:
> > >
> > >1) ErrNo from Libc does not compile
> > >
> > >     eg uses Libc;
> > >          writeln(Libc.ErrNo)
> > >
> > >     gives error messages:
> > >     undefined reference to `errno'
> > >     Error:Error while linking
> > >
> > >    But if you click on ErrNo it shows its definition in Libc
> > >    I use it after call to setsockopt
> >
> > If it is defined in the libc unit it doesn't mean that it can linked (it
> > has to be in the libc library aswell)
> > But that's probably not the case here. IIRC, erno is a var and there was
> > something with exported vars and libraries
>
> The point is that glibc no longer exports the libc 'errno' variable on
> newer systems. This has broken many C programs, and is also completely
> incompatible with the libc units. I have fixed the units (see cvs) but this
> means that those units can no longer be used by default on old systems.
>
> Here is the explanation I put in the README file that accompagnies the
> Libc unit:
>
> -----------------------------------------------------------------------
> Note on the Libc errno variable. On recent systems the errno symbol is no
> longer published in libc. It has been replaced by a __errno_location
> pointer, with a macro in the C header files to mask this. The pascal
> Libc files assume this by default. This also means you cannot set the
> errno value directly, you must use the 'seterrno' procedure for that.
> (see errno.inc)
>
> The old mechanism of a published errno libc variable is still available
> by setting the LIBC_OLDERRNO define when compiling the libc units.
> -----------------------------------------------------------------------
>
> At a later stage we can maybe try to detect it at run-time.
>
> Michael.
>
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives






More information about the Lazarus mailing list