jdm@boulder.Colorado.EDU (James D. Meiss) (08/17/90)
I've got a simple code which uses the ANSI and MacTraps library. I am using Think C 4.0.2, and it runs fine under the debugger. It also works fine when I compile it with the "Smark Link" turned off. When I turn on Smart Link, the code crashes on Launch before it even gets to the first statement (I put a "Debugger()" trap in to see if it got to line 2). I use only the sprintf, atoi, and strlen routines, so naturally my "unsmart" linked code is considerably larger... Has this happened to anyone? Any suggestions appreciated. Jim Meiss Program in Applied Mathematics jdm@boulder.colorado.edu
austing@Apple.COM (Glenn L. Austin) (08/17/90)
jdm@boulder.Colorado.EDU (James D. Meiss) writes: > I've got a simple code which uses the ANSI and MacTraps >library. I am using Think C 4.0.2, and it runs fine under the >debugger. It also works fine when I compile it with the "Smark Link" >turned off. > When I turn on Smart Link, the code crashes on Launch before >it even gets to the first statement (I put a "Debugger()" trap in to >see if it got to line 2). > I use only the sprintf, atoi, and strlen routines, so naturally >my "unsmart" linked code is considerably larger... Since you're on the mac, take advantage of it when you can! The only major routine that you may miss is sprintf, but once you write some code to take the place of sprintf you won't (IMHO) care. For atoi, use StringToNum. If you are using strlen (and I do, myself), only include the .c source file rather than the entire ANSI library. The only routine I've ever wished for was a pstrcat, so here's one I use: pascal void pstrcat(Str255 destStr, Str255 srcStr) { long toCopy = srcStr[0]; if (toCopy + destStr[0] > 255) toCopy = 255 - destStr[0]; BlockMove((Ptr) &srcStr[1], (Ptr) &destStr[destStr[0]+1], toCopy); destStr[0] += (char) toCopy; } > Has this happened to anyone? Any suggestions appreciated. Yes, and I was also using sprintf. I removed that, and everything worked. You have to remember than sprintf does a bunch of work, and sometimes that work is "under the cover of darkness"... -- ----------------------------------------------------------------------------- | Glenn L. Austin | "Turn too soon, run out of room, | | Auto Racing Enthusiast and | Turn too late, much better fate" | | Communications Toolbox Hacker | - Jim Russell Racing School Instructors | | Apple Computer, Inc. | "Drive slower, race faster" - D. Waltrip | | Internet: austing@apple.com |-------------------------------------------| | AppleLink: AUSTIN.GLENN | All opinions stated above are mine -- | | Bellnet: (408) 974-0876 | who else would want them? | -----------------------------------------------------------------------------