Environment Issues Affecting Service Providers

Service providers can only operate in the environment for which they are created. That is, a 16-bit service provider works only in 16-bit environments and a 32-bit service provider works only in 32-bit environments. To create a service provider that runs on any environment, there are two choices: create separate versions for each environment or use an approach known as single sourcing.

Single sourcing allows developers to use a special set of API functions provided by MAPI to reduce the amount of 16 bit-specific work. MAPI has ported a few dozen Win32 API functions to 16 bit. With these functions, 16-bit code can be written as if it were being written with the standard Win32 library of API functions. The code is compiled for the 16-bit environment using some special built-in support. All of the sample services installed with the MAPI SDK are single source services written using these APIs.

The environment used to install the MAPI SDK determines the set of client applications that a service provider can support. Service providers can be written to support clients that run on any of the following operating systems and environments:

When the MAPI SDK is installed under Windows NT, a service provider can be created that can be used by 16-bit or 32-bit Windows NT clients. When the MAPI SDK is installed under Windows 95, a service provider can be created that can target 16-bit clients, Windows 95 clients, and in some cases, Windows NT clients. When the MAPI SDK is installed in a 16-bit environment, a service provider can be created that can target 16-bit clients only. Because MAPI does not support the 32-bit subset, Win32s, these service providers will only run in the 16-bit environment on Windows 3.1 or later.

Service providers should keep their future audience in mind when selecting an installation environment. If 16-bit clients are the only type of clients that will be using a service provider, a 16-bit environment for installation is appropriate. Likewise, if these clients are 32-bit clients, a 32-bit environment will work.

Some service providers, however, need to target clients that operate in all three operating environments: 32-bit Windows NT, 32-bit Windows 95, and 16-bit Windows. To target all environments, a service provider must operate in a 32-bit environment and must install both the 32-bit version of the MAPI SDK and the 16-bit version.

Service provider developers that are planning to target either Windows NT or Windows 95 should write their provider to be used by clients using both operating environments. Targeting both 32-bit environments is easy to do because the additional code required for the second environment is minimal.