ID Number: Q69756
3.00
WINDOWS
Summary:
In the Microsoft Windows environment, an application should perform
only those operations specified by the Windows application programming
interface (API). Specifically, a Windows application should not:
1. Use processor I/O instructions.
2. Issue software interrupts.
3. Install interrupt handlers.
These three operations should be done only in a Windows dynamic-link
library (DLL).
More Information:
The Windows API has been designed to let programmers write
applications in a hardware-independent fashion. However, some
programmers may have noticed that the three operations mentioned
previously can be performed from both Windows version 3.0 DLLs and
applications.
Therefore, it may be tempting to avoid coding these operations in a
DLL, especially if the DLL's only purpose is to execute functions that
seem to operate correctly in an application. However, Microsoft
strongly recommends against this practice, for the following two
reasons:
1. Future Compatibility. Changes may be made to Windows in future
versions such that applications that perform these operations
directly may not execute reliably.
2. Portability. Applications that perform these operations directly
will be more difficult to port to different hardware platforms
(such as Windows running on a different machine architecture).
In summary, executing low-level operations from within a Windows
application may, in a future version of Windows, produce unexpected
results, generate unnecessary maintenance overhead, and have severe
impact on the potential lifetime of that application. To avoid these
problems, machine-specific functionality should be coded in a DLL.