C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Functions Based in a Segment
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
     Form of <base>:
 
          __segname(<string literal>)
 
     A function declared as __based resides in the code segment named
     by <string literal>. You can use the __near or __far keywords
     with the __based keyword when declaring a function. In
     programs that use overlays, you can reduce swapping by using
     __based to group together functions that frequently call one
     another. You also can use __based to ensure that near functions
     reside in the same segment as the functions that call them.
 
     For example:
 
          // FILE 1 - compiled under large model
 
          void __based(__segname("MYSEG")) farfunc()  // far by default
          {
              nearfunc();
          }
 
          // FILE 2 - compiled under large model
 
          void __near __based(__segname("MYSEG") nearfunc()
          {
             // ...
          }
 
     If these two functions were not declared as based, this program
     would suffer a runtime error. Since both functions are
     based in the MYSEG segment, the program executes correctly.
                                    -♦-