Thread View: comp.sys.ibm.pc.programmer
3 messages
3 total messages
Started by Paul Cohen
Wed, 21 Feb 1990 13:52
Far code segments in the small or compact memory model
Author: Paul Cohen
Date: Wed, 21 Feb 1990 13:52
Date: Wed, 21 Feb 1990 13:52
21 lines
1361 bytes
1361 bytes
I need some help with creating a far code segment under Microsoft C in the Compact memory model. I have a program which has just slightly too large a code size to fit in one segment. It has one function which is executed only once so putting it into another segment seems a way to avoid changing to the Large memory model (which slows down execution noticeably). My question is how to do this. Simply declaring the function "far" doesn't do the trick. I have several hypotheses about what more might be needed, but would prefer to avoid the trial and error approach. My hypotheses are: 1. The far function should be in a separate source file from any near functions. 2. All functions called by the far function should be themselves declared as far functions. Can someone comment on these hypotheses or suggest any other magic that might be needed?
Re: Far code segments in the small or compact memory model
Author: Gunther Wil Anderson
Date: Sat, 24 Feb 1990 07:22
Date: Sat, 24 Feb 1990 07:22
13 lines
1229 bytes
1229 bytes
In article <28396@necntc.nec.com> pec@necntc.nec.com (Paul Cohen) writes: >I have a program which has just slightly too large a code size to fit in >one segment. It has one function which is executed only once so putting >it into another segment seems a way to avoid changing to the Large >memory model (which slows down execution noticeably). Use overlaying. Read it up in your compiler manual or dos manual, compile the offending routine in a separate file, and specify it as not part of the permanent code. You may need to place something alse in that state so there is some space for the two to swap between them. Gunther W. Anderson gunther@jhunix.hcf.jhu.edu
Re: Far code segments in the small or compact memory model
Author: Paul Cohen
Date: Thu, 01 Mar 1990 22:36
Date: Thu, 01 Mar 1990 22:36
37 lines
2611 bytes
2611 bytes
In article <4327@jhunix.HCF.JHU.EDU> eisen@jhunix.UUCP (Gunther Wil Anderson) writes: >>In article <28396@necntc.nec.com> pec@necntc.nec.com (Paul Cohen) writes: >>I have a program which has just slightly too large a code size to fit in >>one segment. It has one function which is executed only once so putting >>it into another segment seems a way to avoid changing to the Large >>memory model (which slows down execution noticeably). >Use overlaying. Read it up in your compiler manual or dos manual, >compile the offending routine in a separate file, and specify it as >not part of the permanent code. You may need to place something alse >in that state so there is some space for the two to swap between them. Thanks for the suggestion, but I prefer not to use overlays because of the extra file and extra overhead involved. I also received some mail from Microsoft, giving some incorrect advice on the matter. Since it appears that I am not the only one who did not know how to do this, let me explain what I have discovered since my original posting. As I suspected, it is possible to put one function into a far segment and stay with the SMALL/COMPACT model for the rest of the program. It is not even difficult to do. I put the one "far" function into its own separate source file. In linking, this particular module HAD TO BE LISTED AS THE LAST .obj file file. Otherwise LINK would put it into the same segment as the rest of the program and then complain that there was not enough space. Listing a particular .obj file last required some trickery because of a pecular shortcomming in Microsoft's MAKE utility. Because this MAKE utility permits only fairly short lines it was not possible for me to list all of the object files separately on the LINK command line, but instead had to use the "*.obj" syntax. In order to control which file appeared last, I put it into a separate directory so that I could specify it separately, after the *.obj specification.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads