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

Re: [MiNT] Incorporating other calls into the



Hi,

On Tue, Jun 29, 1999 at 01:26:54PM +0200, Julian Reschke wrote:
> Well,
> 
> those parts of the library which are supposed to work within a MagiC style
> SLB may not use *any* static variables (unless they are really static, like
> a variable to store the _MCH cookie or the MiNT version information).

What about for example localtime and gmtime?  As far as I remember they
_must_ return a pointer to the same static buffer.  Or strtok? Or
getpwent?

If you have a look at current MiNTLibs you will see that I more and more
follow the strategy of the GNU libc in such cases: Take for example the
getpw* function family.  All of these functions (no matter if they are
reentrant or not) end up with a call to `__fgetpwent_r', an internal
library function (for which `fgetpwent_r' is a weak alias in case you
need it yourself).  If the function definition requires that the space for
the result is statically allocated the buffer is provided within the
library.  If it is needed by other functions (for example in the case of
asctime/ctime or gmtime/localtime) then it is globally declared and
`hidden' behind double underscores which are reserved to the library.  But
if only that very function needs the buffer I usually define it
statically within the library module.  Would this break the SLB loader?

I must admit that I'm currently not certain which symbols will end up in
the text and which will end up in the data segment. 

Anyway, if the SLB loader requires major changes in the MiNTLib, please
don't expect me to do this on my own and within a week.  (This remark is
not addressed to Julian but to all that want to use the SLB loader).

Ciao

Guido
-- 
http://stud.uni-sb.de/~gufl0000
mailto:gufl0000@stud.uni-sb.de