[comp.sys.mac] Mac 32K segmentation and program porting.

werner@aecom.yu.edu (Craig Werner) (11/28/89)

	I have the unenviable task of porting a program I wrote under
Unix to microcomputers.  It is a simple program. Basically, it takes
stdin, digests it based on command line arguments, and sends it to
stdout. Porting from Unix to MSDOS involved changing several ints to long
ints, and that was it.  I expected some trouble going to the Mac (such as
lack of stdin, a command line, and stdout) but I am absolutely stumped by
the first glitch, and that is the "code segment too big" error.
Apparently, the Macintosh operating system limits code segments to 32K.
I've heard of segment complaints with the Intel architecture, but in that
case it is the compiler's worry, not mine.  The THINK C documentation is
extremely unenlightening in how to get around this.

	So I appeal to those who may have done this before.  What is the
easiest way to split a program so that all the code segments are
acceptable to the Macintosh.  I'm asking for quick and dirty guidelines,
shortcuts and tricks.  Surely somebody in one of these groups has made
the transition before.  I don't want to become a Macintosh programmer. I
just want to make a program work.


-- 
	        Craig Werner   (future MD/PhD, 4.5 years down, 2.5 to go)
	     werner@aecom.YU.EDU -- Albert Einstein College of Medicine
              (1935-14E Eastchester Rd., Bronx NY 10461, 212-931-2517)
           "Someone write me a letter. I need to know that I'm still alive."

steve@uswmrg2.UUCP (Steve Martin) (12/01/89)

> Apparently, the Macintosh operating system limits code segments to 32K.
> I've heard of segment complaints with the Intel architecture, but in that
> case it is the compiler's worry, not mine.  The THINK C documentation is
> extremely unenlightening in how to get around this.

> What is the easiest way to split a program so that all the code segments
> are acceptable to the Macintosh. 

If you are using Think C just drag one of your modules in the project window
down and it will be placed in a new segment.  Voila'!  This is all described
in the Think C 4.0 manual on pages 72-74.  But it works the same in Version
3.0.

 ==>Steve