home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / linux / 17508 < prev    next >
Encoding:
Text File  |  1992-11-21  |  1.9 KB  |  47 lines

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