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
ekalenda@cup.portal.com (Edward John Kalenda) (09/14/90)
If I remember correctly, this is how I did it before. I compiled using the medium and large models so the code is always _far. By declaring all routines that were not called from other modules as static near, they were called using near calls. In medium and large model, MSC puts each source module in it's own segment. The segment names are something like _TEXT_model-name and _DATA_module-name. Makeing functions static lets the compiler know that they will never be called from another segment, allowing near calls. The reason for compiling in medium or large is that the runtime functions will be called from several different segements and need far calls. Ed ekalenda@cup.portal.com
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.