O'Reilly logo

Microsoft® .NET Compact Framework Kick Start by Ronnie Yates, Erik Rubin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Passing Nested Structures by Using Custom Marshalling Code

As previously noted, the .NET Compact Framework cannot automatically marshal deep structures between the native and managed worlds. If you are in a position where you absolutely must marshal a deep structure between native and managed code, then you will have to write custom marshalling code. This sounds daunting, and it is tricky.

The fundamental idea to writing custom marshalling code is that the nested structure has a specific layout in memory. On the native side, creating a nested structure means that you have deliberately created this layout and populated it with values. On the managed side, you must duplicate the exact same memory layout with managed structures and then pass a reference ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required