Article View: comp.sys.next.programmer
Article #657How do you ld code in mach so that the stdlib is overwritten?
From: Peter Kocks
Date: Mon, 13 Apr 1992 16:12
Date: Mon, 13 Apr 1992 16:12
30 lines
1792 bytes
1792 bytes
Hi, I'm try to port some malloc debugging tools for unix to NeXT/MACH (recently posted to comp.sources.reviewed). This may be futile, but I'm trying anyway. The programs compile fine, but when I try to link I always get messages like "malloc defined twice...exit". On the NeXT there already is a MallocDebug library which is used to override the libsys_s.a version of malloc. You simply add -lMallocDebug to your command line and everything works fine. I looked into the NeXT MallocDebug library and discovered it was not a standard archive. This leads me to conclude that they did not use the standard "ar" "ranlib" when compling there library. So, how do you do it? How do you make a library of object code such that when loaded first, all subsequent loads of objects of the same thing are ignored? In unix this seems simple, in MACH not. Please respond by e-mail --Peter Kocks kocks@chemsitry.stanford.edu P.S. Incidently, the reason I am not using the NeXT provided MallocDebug library is that it does not work as well as I would like with gdb. I'm not programming NeXT applications so the MallocDebug application is not the answer either. The code I have seems like it will do a lot and I will post if it works.
Technical Details
Message-ID:
<1992Apr13.161224.20630@leland.Stanford.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!leland.Stanford.EDU!jessica.stanford.edu!kocksShow Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer,comp.os.mach Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!leland.Stanford.EDU!jessica.stanford.edu!kocks From: kocks@jessica.stanford.edu (Peter Kocks) Subject: How do you ld code in mach so that the stdlib is overwritten? Message-ID: <1992Apr13.161224.20630@leland.Stanford.EDU> Summary: ld, mach, and overriding malloc Keywords: malloc, mach, ld, unix Sender: news@leland.Stanford.EDU (Mr News) Organization: Academic Information Resources Date: Mon, 13 Apr 92 16:12:24 GMT Lines: 31