csbindgen/dotnet-sandbox/NativeMethods.cs

285 lines
14 KiB
C#
Raw Normal View History

2023-02-28 05:49:04 +00:00
// <auto-generated>
// This code is generated by csbindgen.
// DON'T CHANGE THIS DIRECTLY.
// </auto-generated>
2023-04-15 10:45:52 +01:00
#pragma warning disable CS8500
2023-03-06 09:06:52 +00:00
#pragma warning disable CS8981
2023-02-28 05:49:04 +00:00
using System;
using System.Runtime.InteropServices;
2023-08-15 13:18:30 +01:00
2023-02-28 05:49:04 +00:00
namespace CsBindgen
{
2023-03-08 09:41:46 +00:00
internal static unsafe partial class NativeMethods
2023-02-28 05:49:04 +00:00
{
const string __DllName = "csbindgen_tests";
2023-08-15 14:10:06 +01:00
internal const int FOO = 10;
internal const float BAR = 120.432f;
internal const float BAR32 = 120.431f;
internal const double BAR64 = 120.432;
internal const string STR = "aiueo3";
internal static ReadOnlySpan<byte> BSTR => new byte[] { 107, 97, 107, 105, 107, 117, 107, 101, 107, 111 };
internal const byte CBYTE = 65;
internal const char CCHAR = 'あ';
internal const bool BOOLCONST_T = true;
internal const bool BOOLCONST_F = false;
[DllImport(__DllName, EntryPoint = "JPH_PruneContactPoints", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void JPH_PruneContactPoints(void/* UInt128[] */* ioContactPointsOn1, JPH_ContactManifold* ioContactPointsOn2);
2023-03-18 17:44:09 +00:00
/// <summary>my comment!</summary>
[DllImport(__DllName, EntryPoint = "comment_one", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void comment_one(EnumFlags _flags);
2023-03-18 17:44:09 +00:00
/// <summary>Multiline Comments # GOTO Here Foo Bar TO ZZZ</summary>
[DllImport(__DllName, EntryPoint = "long_jpn_comment", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void long_jpn_comment();
2023-04-15 12:38:44 +01:00
[DllImport(__DllName, EntryPoint = "use_vec3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void use_vec3(my_int_vec3 _v3);
2023-03-17 08:46:32 +00:00
[DllImport(__DllName, EntryPoint = "other_2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void other_2(NfcCard _hoge);
[DllImport(__DllName, EntryPoint = "@event", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void @event(@event @event);
2023-09-04 12:44:27 +01:00
[DllImport(__DllName, EntryPoint = "test_func_issue_39", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern void test_func_issue_39(delegate* unmanaged[Cdecl]<int, void> _f);
2023-09-04 12:44:27 +01:00
[DllImport(__DllName, EntryPoint = "test_func_issue_39_variation1", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern void test_func_issue_39_variation1(delegate* unmanaged[Cdecl]<int, int, int, void> _f);
[DllImport(__DllName, EntryPoint = "nonnull_parameter", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-05 08:00:50 +01:00
public static extern void nonnull_parameter(void/* byte[] */* _output_word_uuid);
2023-09-04 12:54:04 +01:00
2023-09-04 12:57:50 +01:00
[DllImport(__DllName, EntryPoint = "non_nonnull_parameter2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-05 08:00:50 +01:00
public static extern void non_nonnull_parameter2(byte* _output_word_uuid);
[DllImport(__DllName, EntryPoint = "nonzero_test", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-05 08:42:44 +01:00
public static extern void nonzero_test(sbyte _a, byte _b, uint _c);
2023-09-04 12:57:50 +01:00
2023-09-04 12:54:04 +01:00
[DllImport(__DllName, EntryPoint = "ge", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void ge(delegate* unmanaged[Cdecl]<int, int, int, void> _f);
2023-09-04 12:44:27 +01:00
2023-03-12 22:34:15 +00:00
[DllImport(__DllName, EntryPoint = "nest_test", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern void nest_test(delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<int, void>*, int> _f);
2023-03-12 22:34:15 +00:00
[DllImport(__DllName, EntryPoint = "alias_test1", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 14:15:17 +00:00
public static extern void alias_test1(long* _a);
[DllImport(__DllName, EntryPoint = "alias_test2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 14:15:17 +00:00
public static extern void alias_test2(long _b);
[DllImport(__DllName, EntryPoint = "nullpointer_test", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 20:00:14 +00:00
public static extern void nullpointer_test(byte* p);
[DllImport(__DllName, EntryPoint = "csharp_to_rust_string", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-08 09:41:46 +00:00
public static extern void csharp_to_rust_string(ushort* utf16_str, int utf16_len);
[DllImport(__DllName, EntryPoint = "csharp_to_rust_utf8", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-08 09:41:46 +00:00
public static extern void csharp_to_rust_utf8(byte* utf8_str, int utf8_len);
[DllImport(__DllName, EntryPoint = "csharp_to_rust_bytes", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-08 09:41:46 +00:00
public static extern void csharp_to_rust_bytes(byte* bytes, int len);
[DllImport(__DllName, EntryPoint = "callback_test", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern int callback_test(delegate* unmanaged[Cdecl]<int, int> cb);
2023-03-05 06:30:41 +00:00
[DllImport(__DllName, EntryPoint = "csharp_to_rust", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern void csharp_to_rust(delegate* unmanaged[Cdecl]<int, int, int> cb);
2023-03-06 20:00:14 +00:00
[DllImport(__DllName, EntryPoint = "rust_to_csharp", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern delegate* unmanaged[Cdecl]<int, int, int> rust_to_csharp();
2023-03-06 20:00:14 +00:00
[DllImport(__DllName, EntryPoint = "sum", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 20:00:14 +00:00
public static extern int sum(int x, int y);
[DllImport(__DllName, EntryPoint = "cbt", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 20:00:14 +00:00
public static extern void cbt(CallbackTable _cb);
[DllImport(__DllName, EntryPoint = "nullable_callback_test", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern int nullable_callback_test(delegate* unmanaged[Cdecl]<int, int> cb);
2023-03-05 06:30:41 +00:00
[DllImport(__DllName, EntryPoint = "types_iroiro", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 20:00:14 +00:00
public static extern void types_iroiro(nint _i, nuint _u, CLong _cl, CULong _cul);
[DllImport(__DllName, EntryPoint = "callback_test2", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-09-04 12:54:04 +01:00
public static extern delegate* unmanaged[Cdecl]<int, int> callback_test2();
2023-03-05 06:30:41 +00:00
[DllImport(__DllName, EntryPoint = "callback", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-05 06:30:41 +00:00
public static extern int callback(int a);
[DllImport(__DllName, EntryPoint = "enum_test", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-05 08:18:52 +00:00
public static extern int enum_test(IntEnumTest i);
[DllImport(__DllName, EntryPoint = "nop", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void nop();
[DllImport(__DllName, EntryPoint = "my_add", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-02-28 05:49:04 +00:00
public static extern int my_add(int x, int y);
[DllImport(__DllName, EntryPoint = "create_counter_context", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-04-17 12:32:52 +01:00
public static extern CounterContext* create_counter_context();
2023-03-04 16:03:33 +00:00
[DllImport(__DllName, EntryPoint = "counter_context_insert", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-04-17 12:32:52 +01:00
public static extern void counter_context_insert(CounterContext* context, int value);
2023-03-04 16:03:33 +00:00
[DllImport(__DllName, EntryPoint = "destroy_counter_context", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-04-17 12:32:52 +01:00
public static extern void destroy_counter_context(CounterContext* context);
2023-03-04 16:03:33 +00:00
[DllImport(__DllName, EntryPoint = "pass_vector3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 20:00:14 +00:00
public static extern void pass_vector3(MyVector3 v3);
[DllImport(__DllName, EntryPoint = "return_union", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 20:00:14 +00:00
public static extern MyUnion return_union();
[DllImport(__DllName, EntryPoint = "my_bool", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool my_bool([MarshalAs(UnmanagedType.U1)] bool x, [MarshalAs(UnmanagedType.U1)] bool y, [MarshalAs(UnmanagedType.U1)] bool z, bool* xr, bool* yr, bool* zr);
[DllImport(__DllName, EntryPoint = "alloc_c_string", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern byte* alloc_c_string();
[DllImport(__DllName, EntryPoint = "free_c_string", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void free_c_string(byte* str);
[DllImport(__DllName, EntryPoint = "alloc_u8_string", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern ByteBuffer* alloc_u8_string();
[DllImport(__DllName, EntryPoint = "free_u8_string", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void free_u8_string(ByteBuffer* buffer);
[DllImport(__DllName, EntryPoint = "alloc_u8_buffer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern ByteBuffer* alloc_u8_buffer();
[DllImport(__DllName, EntryPoint = "free_u8_buffer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void free_u8_buffer(ByteBuffer* buffer);
2023-03-04 05:39:45 +00:00
[DllImport(__DllName, EntryPoint = "alloc_i32_buffer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern ByteBuffer* alloc_i32_buffer();
2023-03-04 05:39:45 +00:00
[DllImport(__DllName, EntryPoint = "free_i32_buffer", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void free_i32_buffer(ByteBuffer* buffer);
2023-03-04 05:39:45 +00:00
[DllImport(__DllName, EntryPoint = "create_context", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-04 05:54:48 +00:00
public static extern Context* create_context();
2023-02-28 05:49:04 +00:00
[DllImport(__DllName, EntryPoint = "delete_context", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-04 05:54:48 +00:00
public static extern void delete_context(Context* context);
[DllImport(__DllName, EntryPoint = "call_bindgen", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void call_bindgen();
[DllImport(__DllName, EntryPoint = "call_bindgen_lz4", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
2023-03-06 09:06:52 +00:00
public static extern void call_bindgen_lz4();
2023-09-06 14:27:51 +01:00
[DllImport(__DllName, EntryPoint = "reference_type", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void reference_type(int* _a, int** _b, void/* byte[] */* _c, Context* _d);
2023-03-04 05:54:48 +00:00
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct JPH_ContactManifold
{
public float mPenetrationDepth;
public fixed byte/* UInt128, this length is invalid so must keep pointer and can't edit from C# */ mWorldSpaceContactPointsOn1[65];
public fixed byte/* UInt128, this length is invalid so must keep pointer and can't edit from C# */ mWorldSpaceContactPointsOn2[65];
public fixed byte/* UInt128, this length is invalid so must keep pointer and can't edit from C# */ mWorldSpaceContactPointsOn3[65];
public fixed byte/* UInt128, this length is invalid so must keep pointer and can't edit from C# */ mWorldSpaceContactPointsOn4[65];
public fixed uint mWorldSpaceContactPointsOn5[65];
public fixed byte png_name[5];
}
2023-04-15 12:38:44 +01:00
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct my_int_vec3
{
public int Item1;
public int Item2;
public int Item3;
}
2023-03-17 08:46:32 +00:00
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct NfcCard
{
2023-09-04 12:54:04 +01:00
public delegate* unmanaged[Cdecl]<ByteArray, ByteArray> @delegate;
2023-03-17 08:46:32 +00:00
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct ByteArray
{
public int i;
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct @event
{
public int a;
}
[StructLayout(LayoutKind.Sequential)]
2023-04-17 12:32:52 +01:00
internal unsafe partial struct CounterContext
{
}
2023-03-06 20:00:14 +00:00
[StructLayout(LayoutKind.Explicit)]
internal unsafe partial struct MyUnion
{
[FieldOffset(0)]
public int foo;
[FieldOffset(0)]
public long bar;
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct MyVector3
{
public float x;
public float y;
public float z;
}
2023-03-04 05:54:48 +00:00
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct Context
2023-03-04 05:54:48 +00:00
{
[MarshalAs(UnmanagedType.U1)] public bool foo;
2023-02-28 05:49:04 +00:00
}
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct ByteBuffer
{
public byte* ptr;
public int length;
public int capacity;
}
2023-03-06 20:00:14 +00:00
[StructLayout(LayoutKind.Sequential)]
internal unsafe partial struct CallbackTable
{
2023-09-04 12:54:04 +01:00
public delegate* unmanaged[Cdecl]<void> foo;
public delegate* unmanaged[Cdecl]<int, int> foobar;
2023-03-06 20:00:14 +00:00
}
2023-03-05 08:18:52 +00:00
[Flags]
internal enum EnumFlags : uint
{
A = 0b00000001,
B = 0b00000010,
C = 0b00000100,
ABC = A | B | C,
}
2023-03-06 20:00:14 +00:00
internal enum IntEnumTest : sbyte
2023-03-05 08:18:52 +00:00
{
A = 1,
B = 2,
C = 10,
}
2023-02-28 05:49:04 +00:00
}