Applications and Services Development Changes
You may need to modify your Cesysgen.bat file or applications that depend on the Windows CE features used to develop applications and services, as they have changed in the following ways:
The Beta .NET Compact Framework (SYSGEN_DOTNET_PROFILE2) has been replaced with .NET Compact Framework 1.0 and its dependencies. The new flags are SYSGEN_DOTNET and SYSGEN_DOTNETSUPPORT. For more information, see .NET Compact Framework Overview.
With the introduction of DCOM in Windows CE .NET version 4.0, compliance with COM rules is required because DCOM supports multiple apartment models and DCOM objects have a strong affinity for the apartments they occupy. In addition, the DCOM code base was consolidated with the small in-proc only COM code base. For example, the following COM rules are now enforced:
- The requirement to initialize apartments before using COM.
- Regarding reference counting for CoInitializeEx and CoUninitialize: Calls to CoInitializeEx must be paired with an equal number of calls to CoUninitialize. Prior to Windows CE .NET 4.0, CoInitializeEx was an empty function and paired calls were not required.
- Rules on apartment declarations for COM objects. The previous COM implementation only supported multithreaded apartments but still allowed loading of objects declared as single-threaded.
As a result of these changes, Windows CE .NET 4.0 is not backwards compatible with older applications that do not comply with these requirements. To partially rectify this problem without requiring changing code or adding registry entries, the following changes were made in Windows CE .NET 4.0:
- For executable (.exe) files linked using tools prior to version 4.0, if an apartment was not initialized before using COM functionality, the apartment is automatically initialized to multithreaded when a COM API function is called. This causes a memory leak when the thread terminates, but it enables the application to run. This approach does not work with dynamic link library (.dll) files.
- To enable older .dll files hosted in newer executables, you can use the registry to identify executables that should be automatically initialized. To do this, add a new DWORD entry to the HKEY_LOCAL_MACHINE\Software\Microsoft\OLE\LegacyApps key. The new entry should have the same name as the executable and a value of 1. This step is only necessary for executables that load .dll files.
- Any declaration of apartment requirements in the registry is ignored for .dll files that were linked using tools prior to version 4.0. Instead, the apartment requirement is automatically set to free-threaded.
- The default apartment type on Windows CE .NET is free-threaded, in contrast to Windows, where it is single-threaded. This apartment type is used if one is not declared in the registry.
See Also
Applications and Services Development | What's New | New OS Features | New Features in Windows CE .NET 4.0 | New Features in Windows CE .NET 4.1 | Migrating from Windows CE 3.0 to Windows CE .NET
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.