This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Design Overview
Building a custom marshaler involves the following steps.
- Defining both the managed and unmanaged interfaces being marshaled. One interfaces is managed and the other is unmanaged.
- Defining wrappers that are responsible for converting from one interface to the other. If marshaling in both directions is desired, a separate wrapper is used in each direction.
- Defining a custom marshaler that is responsible for activating and deactivating the appropriate wrapper at the appropriate time.
- Identifying when and where the custom marshaler is to be used.
This section describes each of these four steps in details
Because custom marshalers need to deal with unmanaged interface definitions and need to be able to make calls through such interfaces, there are limitations on which compilers can be used to build custom marshalers. Currently, Managed C++ is the only language that is suitable for building custom marshalers.