[alt.msdos.programmer] Mixed Memory Model Question

west@turing.toronto.edu (Tom West) (09/14/90)

  I have a question about mixing memory models.  I have a large program that
has three very separate parts to it.  While each part is less than 64k, the
total is much larger.  Since there are very few calls that cross the
boundary of the three blocks, I would like to make each section small model
if possible.  Unfortunately, I'm not sure how this is done.  My guess is:

  Each section is compiled small model, but any routines that are called
from another section of the program are declared far.  Furthermore, one
must somehow make sure that all parts of a single section are placed in
the same segment.  I'm not sure what options one would link it with.

  The assumption is that the total program has less than 64k of data.  If
it was larger, then one would compile each section with the compact model.
I am using MSC 6.0, but I assume that the experience is transferrable.

  Could anyone experienced with mixing memory models either confirm or 
correct this?  Thanks.

				Tom West 
			    west@turing.toronto.edu

emigh@ncsugn.ncsu.edu (Ted H. Emigh) (09/14/90)

In article <1990Sep13.141323.10882@jarvis.csri.toronto.edu> west@turing.toronto.edu (Tom West) writes:
>
>  I have a question about mixing memory models.  I have a large program that
>has three very separate parts to it.  While each part is less than 64k, the
>total is much larger.  Since there are very few calls that cross the
>boundary of the three blocks, I would like to make each section small model
>if possible.  Unfortunately, I'm not sure how this is done.  My guess is:
>
>  Each section is compiled small model, but any routines that are called
>from another section of the program are declared far.  Furthermore, one
>must somehow make sure that all parts of a single section are placed in
>the same segment.  I'm not sure what options one would link it with.
>
>I am using MSC 6.0, but I assume that the experience is transferrable.

I use Turbo C.

Basically, this will not work.  The reason is the library functions.  In
the small model, the library functions reside in the same 64K as the rest
of the program.  You must use them from several different segments, so they
must be large model.

You CAN declare your functions as "near", which will reduce some overhead.
If the "cross call" are not very numerous (either in number or functionally),
then you might try to compile it as several programs and use "spawn" (or
similar functions) to go between the modules.