Search code examples
c#monointeropmarshalling

Change the LayoutKind from Fixed to Sequencial for CppSharp C# bindings


I am generating C# bindings for a C library using CppSharp, but the generated bindings generate explicit structure layouts (LayoutKind.Explicit).

This makes the code fixed to a 32bit or 64bit configuration since, Is there any way of changing the generated code to use a Sequencial layout instead?


Solution

  • CppSharp author here! You can enable sequential layouts with the GenerateSequentialLayout option.