Welcome to WCharT.Net a modern cross platform package to interop with WCharT data.
To work with WCharT data create a new instance of WCharTString
:
//Read data from a byte*
byte* pointer = NativeCall();
var str = new WCharTString(pointer).GetString();
//Create a buffer for a native library and read the data after it was filled
ReadOnlySpan<byte> data = new WCharTString(int bufferCharSize);
NativeCall(...);
var str = data.GetString();
//Pass a string to a native library
ReadOnlySpan<byte> data = new WCharTString(string str);
NativeCall(data);
//Can be used in fixed statements
var data = new WCharTString(string str);
fixed (byte* ptr = data)
{
NativeCall(ptr);
}
To build the solution locally execute the following commands:
$ git clone https://github.com/badcel/WCharT.Net.git
$ cd WCharT.Net/src
$ dotnet fsi build.fsx
If the application targets at least .NET 8 the nuget package allows applications to be published as Native AOT as itself is AOT compatible.
HidApi.Net is licensed under the terms of the MIT-License. Please see the license file for further information.