4

I've run into the __loadds keyword as a function declaration modifier in some old code for 16-bit Windows that I was looking at out of curiosity.

A Google search did not yield anything useful, presumably because no one uses the compilers that supported that keyword anymore. I'm guessing from its name that it had something to do with the DS (data segment) register and the segmented memory model of x86 real mode.

Govind Parmar
  • 20,656
  • 7
  • 53
  • 85
  • 2
    It is obsolete unless you are trying to build 16-bit Windows applications in some environments. The `__loadds` keyword is described as ___loadds This keyword aid those programming Microsoft Windows. __loadds causes the compiler to load DS from DGROUP on entry to the function and to restore DS on exit._ . It is applied to functions as a modifier. – Michael Petch Jan 31 '17 at 15:37

1 Answers1

2

The online documentation for the Digital Mars compiler talks about this function declaration modifier:

__loadds

This keyword aid those programming Microsoft Windows. __loadds causes the compiler to load DS from DGROUP on entry to the function and to restore DS on exit.

The -mu compiler option applies __loadds to all functions.

Note that this modifier is completely obsolete, as applies only to 16-bit Windows environments, like Windows 3.1.

Community
  • 1
  • 1
Alex
  • 779
  • 7
  • 15
  • 2
    This is a link only answer. Please take the relevant part from the website that applies and make it part of your answer. – Michael Petch Feb 01 '17 at 00:14
  • 2
    In lieu of a downvote, I've turned this into the answer it should have been. Please take note of Michael's advice and this example in the future when you want to refer to external resources. – Cody Gray - on strike Feb 01 '17 at 08:18
  • 1
    Thanks for the guidance guys, I try to improve on it! – Alex Feb 01 '17 at 20:57