home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.linux
- Path: sparky!uunet!cs.utexas.edu!uwm.edu!daffy!spock.cs.wisc.edu!quale
- From: quale@spock.cs.wisc.edu (Doug Quale)
- Subject: Re: function-->macro bugs.
- Message-ID: <1992Nov22.032801.24502@daffy.cs.wisc.edu>
- Sender: news@daffy.cs.wisc.edu (The News)
- Reply-To: quale@saavik.cs.wisc.edu
- Organization: Undergraduate Projects Lab, UW-Madison
- References: <1992Nov21.000241.9744@klaava.Helsinki.FI> <By1p2E.5L9@news.cso.uiuc.edu> <1992Nov21.123616.10447@klaava.Helsinki.FI>
- Date: Sun, 22 Nov 1992 03:28:01 GMT
- Lines: 34
-
- In article <1992Nov21.123616.10447@klaava.Helsinki.FI> wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
- >jy10033@ehsn11.cen.uiuc.edu (Joshua M Yelon) writes:
- >>but I'm curious: how _do_ you replace a library routine?
- >
- >You change the library source code. Only standard way to go. In ANSI
- >C, programs mustn't go around changing standard library routines. The
- >reason for this is that the rest of the library might depend on
- >certain weird behaviour of the routine under some circumstances, which
- >the replacement doesn't have. For instance, the library might have a
- >hidden flag, __make_malloc_free_instead__, which the real malloc
- >checks.
- >
- >
- >>Or is there simply no way to do it?
- >
-
- In my admittedly imperfect understanding, this is not true in POSIX.
- The library routines are *required* not to behave on behavior of other
- routines. If you look at GNUs libc, glibc, you'll find that all the
- library routines that are called by other library routines have names
- not in the user namespace (beginning with underscores), so that if
- the user replaces a library routine it will not break anything else.
-
- In order to replace a standard routine, you must:
-
- 1) not include the header file that declares it
- 2) make it static
-
- Since I may be all wet, someone who understands this stuff thoroughly
- should probably comment.
-
- --
- Doug Quale
- quale@saavik.cs.wisc.edu
-