Re: shadowing libc



On Fri, 19 Aug 2005, Bruno Haible wrote:

> > A macro does the job as well in most cases.
>
> ISO C and POSIX want most of their specified functions to be available as
> functions. (putc, setjmp, ... are exceptions.) And furthermore as functions
> of "external linkage" (ISO C 99 7.1.2.(6)). This means we have to write
>
>        #define strftime our_strftime
>
> in a header file and
>
>        size_t
>        our_strftime(char *s, size_t max, const char *format, const struct tm *tm)
>        {
>          return gl_strftime (s, max, format, tm, _gl_thread_locale ());
>        }
>
> in a .c file.

Right.  At the same time this means that we don't have to follow
the POSIX API at all.  If strftime is a wicked name, we will
instead go for glu_time_format for example, and pass to it
whatever parameters we think makes sense.  The choice for
application developers is to either: 1) Use autoconf to migrate
automagically, 2) replace strftime by glu_posix_strftime, this
can be done automatically, or 3) use our cannonical interface
that may need a bit of refactoring.

"glu" is a suggestion of course.

> LD_PRELOAD works only on glibc systems, on Solaris, and - under a different
> name - on Tru64. Not on the many other platforms that GNOME runs on.

We don't care /that much/ about other systems.  The main concern
other than Linux and Windows have been Solaris.  What LD_PRELOAD
buys is uniformity of locale data on the Linux platform, that we
would lack otherwise.  I don't think we can push all those
core-utils and other packages to use our library.  Or we may
expect ditributors to push in the library at build time...

> Bruno

--behdad
http://behdad.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]