X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3C08E523.C844E69B@phekda.freeserve.co.uk> Date: Sat, 01 Dec 2001 14:11:47 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: DJGPP workers Subject: Description of stubs in develop.txi Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com 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/