Skip to content

A modern cross platform package to interop with WCharT data.

License

Notifications You must be signed in to change notification settings

badcel/WCharT.Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WCharT.Net

Build StatusNuGetLicense (MIT)

Welcome to WCharT.Net a modern cross platform package to interop with WCharT data.

Use

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);
}

Build

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

Native AOT

If the application targets at least .NET 8 the nuget package allows applications to be published as Native AOT as itself is AOT compatible.

Licensing terms

HidApi.Net is licensed under the terms of the MIT-License. Please see the license file for further information.