Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Struct layoutkind #66

Merged
merged 2 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Specify LayoutKind for structs
  • Loading branch information
sundermann committed Jul 25, 2018
commit 5f7cc6d55647c56331c00b71a51cbfba6d238e41
1 change: 1 addition & 0 deletions src/Gir.Tests/ImportantGeneratables/GObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ public void GTypeStructsAreInternal ()

namespace GObject
{
[StructLayout(LayoutKind.Sequential)]
internal struct ObjectClass
{
TypeClass GTypeClass;
Expand Down
1 change: 1 addition & 0 deletions src/Gir.Tests/ImportantGeneratables/List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public void ListIsGenerated ()

namespace GLib
{
[StructLayout(LayoutKind.Sequential)]
public struct List
{
IntPtr Data;
Expand Down
1 change: 1 addition & 0 deletions src/Gir.Tests/RecordTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public void TestRecordIsGenerated ()
namespace GLib
{
///<summary>Contains the public fields of a GByteArray.</summary>
[StructLayout(LayoutKind.Sequential)]
public struct ByteArray
{
///<summary>
Expand Down
1 change: 1 addition & 0 deletions src/Gir/Generation/Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public void Generate (GenerationOptions opts)
if (!string.IsNullOrEmpty (GLibIsGTypeStructFor))
access = "internal";

writer.WriteLine ("[StructLayout(LayoutKind.Sequential)]");
writer.WriteLine ($"{access} struct {Name}");
writer.WriteLine ("{");

Expand Down