Mail Archives: djgpp-workers/2001/12/01/09:30:33
Hello.
There is a section about stubs in develop.txi, which currently reads:
"libc/stubs.h
------------
The *only* time you put something in `stubs.h' is if an ANSI/POSIX
function in libc needs to call a non-ANSI/POSIX function in libc, in
which case the non-ANSI/POSIX function needs to be listed in `stubs.h'
(or, for ANSI functions calling POSIX-only functions).
There is no other reason why a function would get listed in stubs.
The "stubbed name" (`__foo') is *not* part of the published API."
If I understand things correctly, libc/stubs.h is used to avoid polluting
a C application's namespace with non-ANSI and non-POSIX symbols, unless
the application explicitly uses these symbols. This is done by having the
function prefixed by '__'. Then we have a stub without the prefix which
calls the prefixed function. Library code calls the prefixed function
(e.g. __fsync()) and application calls the unprefixed function (e.g.
fsync()).
The library code is written as if it were calling the unprefixed function.
But we want it to call the prefixed function. So any code using non-ANSI
and non-POSIX functions should include libc/stubs.h as the first include
file, so that it calls the prefixed version of the functions.
Is this correct? If so, I'll post a patch to update the description in
develop.txi.
Thanks, bye, Rich =]
--
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/
- Raw text -