Overview
The marshalling library is an advanced header-only template library which enables easy and largely transparent exchange of objects between assemblies in C++, even if the sender and receiver represent the object differently, and even if different memory heaps are used between assemblies. This potentially allows different assemblies to communicate and exchange complex types where different compiler types, versions, settings, and incompatible STL implementations are used between them.
This library is perfectly suited for exchanging objects over extern "C" exported functions or pure virtual interfaces, including instances of STL types or instances of custom types that contain STL objects, without requiring the same compiler version and settings to be used when consuming the assembly. This is something that is extremely difficult to achieve in C++, and which the language currently provides no support for. Simply compiling two assemblies in different configurations like "debug" and "release" is enough to make assemblies incompatible on most implementations. The marshalling library solves this problem comprehensively for any C++03 conformant compiler onwards, and allows exchange of potentially any data structures, where the assemblies have at least enough C++ ABI compatibility to exchange pure virtual interfaces. Applications that want to use plugin-based systems, provide external C++ based APIs, or adopt a distributed application model, or any other scenario involving native code compiled separately needing to communicate within the same process, can benefit from this library.
Detailed Information
Public Members
Marshal Operators
Marshal operators are the recommended way to perform marshalling.
Marshal Namespace Aliases
These alias templates provide a shorter namespace for the marshal operator helpers.
Marshal Constructor Helpers
These types are involved in the process of creating marshal constructors for user-defined types.
Ownership Helpers
These types assist with safely transferring ownership of marshallable objects across assembly boundaries.
Low-level Marshal Types
These types form part of the public API, but generally should not need to be used directly in code.
Status of the Library
This library is in an extremely advanced and mature state, with a high level of optimization in place, as well as extensive cross-compiler testing having been performed. Full support is provided for any compiler supporting at least C++03 and higher, with up to date support also included for all relevant C++11, C++14, and C++17(draft) features and types. A comprehensive set of unit tests is provided to verify the operation of the library. This library is considered stable and available for use in all areas of code.
Note that there has been interest in having the marshalling library included as part of the Boost C++ Libraries project. If this library is adopted by Boost, and compatibility is maintained with the existing implementation here, consideration should be given to migrating to the Boost implementation.