


The Structs sample uses the following unmanaged functions, shown with their original function declaration:
#Sequential structures how to
This sample demonstrates how to pass a structure that points to a second structure, pass a structure with an embedded structure, and pass a structure with an embedded array. Passes a null reference ( Nothing in Visual Basic) instead of a reference to a value type. Passes a type with native-packing definitions. Passes unions with mixed types (integer and string). Passes unions with value types (integer and double). The called function allocates memory for the array. Passes an array of structures that contain integers and strings as an Out parameter. Members of the array can be changed.Īrray of structures with integers and strings by reference. Passes an array of structures that contain only integers as an In/Out parameter. Passes a structure that contains a pointer to a second structure as a member.Īrray of structures with integers by value. Structure with a pointer to another structure. The structure is flattened to one big structure in the managed prototype. Passes a class that represents a structure with nested structures in the unmanaged function. Structure with nested structures (flattened). Passes a class with integer members as an In/Out parameter, like the managed case. The following table lists marshalling options for classes, structures, and unions describes their usage and provides a link to the corresponding platform invoke sample. One notable difference is that structures are value types and classes are reference types. They can also have static and nonstatic methods. Both can have fields, properties, and events. Classes and structures are similar in the.
