Skip to content

Commit 7287589

Browse files
committed
Add struct layout, to be safe
1 parent 735af78 commit 7287589

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Libuv/UV.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
using System.Runtime.InteropServices;
44

55
namespace Libuv {
6+
[StructLayout(LayoutKind.Sequential)]
67
public struct uv_handle_t {
78
public uv_handle_type type;
89
public IntPtr close_cb;
910
public IntPtr data;
1011
}
12+
[StructLayout(LayoutKind.Sequential)]
1113
public struct uv_req_t {
1214
public uv_req_type type;
1315
public IntPtr data;
1416
}
17+
[StructLayout(LayoutKind.Sequential)]
1518
public struct uv_connect_t {
1619
public uv_req_type type;
1720
public IntPtr data;
@@ -24,6 +27,7 @@ public struct uv_connect_t {
2427
public IntPtr cb;
2528
public IntPtr handle;
2629
}
30+
[StructLayout(LayoutKind.Sequential)]
2731
public struct uv_shutdown_t {
2832
public uv_req_type type;
2933
public IntPtr data;
@@ -36,6 +40,7 @@ public struct uv_shutdown_t {
3640
public IntPtr handle;
3741
public IntPtr cb;
3842
}
43+
[StructLayout(LayoutKind.Sequential)]
3944
public struct uv_err_t
4045
{
4146
public uv_err_code code;
@@ -122,6 +127,7 @@ public static class Sizes {
122127
public static readonly int CheckWatcherSize = 64;
123128
public static readonly int TimerWatcherSize = 80;
124129
public static readonly int TcpTSize = 152;
130+
public static readonly int PipeTSize = 156;
125131
public static readonly int ShutdownTSize = 16;
126132
public static readonly int ConnectTSize = 24;
127133
public static readonly int WriteTSize = 68;
@@ -136,6 +142,7 @@ public static class Sizes {
136142
public static readonly int WriteTSize = 52;
137143
#endif
138144
}
145+
[StructLayout(LayoutKind.Sequential)]
139146
#if __MonoCS__
140147
public struct uv_buf_t
141148
{

0 commit comments

Comments
 (0)