C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
__loadds
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
  Keyword:   __loadds
 
  Syntax:    __loadds declarator
 
  Summary:   Loads the data-segment register (DS) with a segment
             value upon entry to a function.
 
  See also:  __saveregs, __export, __interrupt
             Naming Segments
 
     The __loadds keyword causes the data-segment (DS) register to be
     loaded with a specified segment value upon entering the specified
     function. The previous DS value is restored when the function
     terminates.
 
     Functions declared with the __loadds keyword cause the most
     recently specified data segment to be loaded into the DS register.
     The compiler uses the segment name specified by the /ND
     (name-data-segment) option or, if no segment has been specified,
     the default group DGROUP. Note that this function modifier has the
     same effect as the /Au option, but on a function-by-function
     basis.
 
     Example
 
     The main file contains a declaration of funcsample, a far function
     taking a single argument of any pointer type and returning no
     value. The function loads a new data segment upon entry.
 
          void __far __loadds funcsample( void *s );
 
          main()
          {
              char s[11];
 
              // Call the sample __loadds function
              funcsample( (void *)s );
          }
 
     The second file defines the function, and is compiled with the
     option /ND MY_DATA.
 
          // Define the function that will load DS from MY_DATA
          void __far __loadds funcsample( void *s )
          {
          ∙ ∙ ∙
          }
                                    -♦-