Marshalling Simple Structures
The .NET Compact Framework can marshal simple structures between the managed and native worlds. Unlike the full desktop .NET Framework, there are strong restrictions governing what kinds of structures can be marshalled automatically.
First, the .NET Compact Framework marshals all simple structures by reference. Thus, the native side sees parameters that are structures as pointers to the structure. As such, the native code can alter the contents of structures, and the alterations are visible as side effects on the managed side.
Another important rule is that only references to “shallow” structures can be marshalled automatically. This means that the structure can contain an arbitrary number of fundamental data types, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access