Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!thetone!swilson From: swilson%thetone@Sun.COM (Scott Wilson) Newsgroups: comp.sys.mac.programmer Subject: Re: LSC 3.0, argc & argv, linking Message-ID: <67442@sun.uucp> Date: 8 Sep 88 17:25:57 GMT References: <66791@sun.uucp> <2391@pixar.UUCP> <67189@sun.uucp> <3005@mit-amt> Sender: news@sun.uucp Reply-To: swilson@sun.UUCP (Scott Wilson) Organization: Sun Microsystems, Mountain View Lines: 38 >If the library function was not automatically superceded, the error did not >occur (even worse, the problem couldn't be solved until I ran "strings" on >the other guys code). After all, YOU CAN NAME YOUR FUNCTIONS ANYTHING YOU >WANT while the libraries are ALREADY DEFINED. > >Please rename the functions rather than reusing the existing symbol... Part of the point, though, is that reusing the library symbol may be exactly what you want. For instance, let's say that code runs great on machine A. When you port it to machine B you find that some library function is broken. So you write your own version of the function and link it in superseding the broken library funtion. If the linker doesn't allow you do this, you resort to ugliness like putting "#define fgetc XXXfgetc" at the top of your code. This is what I have done with THINK C (and I'm not implying their library is broken, but in some cases I wanted to use home-made functions that were more compatible with UNIX). I would much rather just link the code with my versions of the library functions. Another point to consider is that those "already defined" library names can be non-standard names that will conflict with ones you've chosen. For example if you had a program that had a function called cgets() it wouldn't link with THINK C because this is a (non-standard) part of their stdio library. (I think that's the name of the function, but I wouldn't bet my life on it because I don't have my THINK C docs at work.) It sounds like a warning from the linker that a library symbol was being superseded would have prevented your problem while allowing the type of things I describe. I don't how hard that would be to implement, but I could live with the warnings. -- Scott Wilson arpa: swilson@sun.com Sun Microsystems uucp: ...!sun!swilson Mt. View, CA "It's the end of the world as we know it, and I feel fine." -R.E.M.