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►
────────────────────────────────────────────────────────────────────────────
Keyword: _loadds
Syntax: _loadds declarator
Summary: Loads the data-segment register (DS) with a segment
value upon entry to a function.
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.
The following example contains two files.
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 )
{
∙ ∙ ∙
}
-♦-