DeafMan1983.Conversion 4.0.0

dotnet add package DeafMan1983.Conversion --version 4.0.0
NuGet\Install-Package DeafMan1983.Conversion -Version 4.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DeafMan1983.Conversion" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DeafMan1983.Conversion --version 4.0.0
#r "nuget: DeafMan1983.Conversion, 4.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DeafMan1983.Conversion as a Cake Addin
#addin nuget:?package=DeafMan1983.Conversion&version=4.0.0

// Install DeafMan1983.Conversion as a Cake Tool
#tool nuget:?package=DeafMan1983.Conversion&version=4.0.0

ConversionFunctions

sbyte *, sbyte **, byte *, byte ** void *, string and string[]

Changvs and fixes:<br /> Fixed: <br />

  • Since NullReferenceExeepction cause some can't new instance
  • some functions

Replaced:<br />

  • StringSize to LengthSize
  • StringwithSBytePointer to StringFromSBytePointer
  • StringArrayWithSByteDoublePointers to StringArrayFromByteDoublePointers
  • SBytePointerWithString to SBytePointerFromString
  • SByteDoublePointerWithStringArrays to SByteDoublePointersFromStringArray

Added;<br />

  • byte * and byte ** for StringFromBytePointer, StringArrayFromByteDoublePointers,
  • BytePointerFromString, ByteDoublePointersFromStringArray
  • void * for Alloc, Free and Delete <br /> pdated to 4.0.0

How does it work? If you use sbyte* for string like example in X11's XOpenDisplay() or SDL_SetWindowTitle()

For X11 from TerraFX.Interop.Xlib

....
Display *display = XOpenDisplay(SBytePointerFromString(string.Empty));
....

Or for SDL3 from DeafMan1983.Interop.SDL3

....
SDL_SetWindows(window, SBytePointerWithString("Hello SDL3 Window"));
....

For string for sbyte * like example X11's XDisplayString() or SDL3's SDL_GetWindowTitle()

....
string d_str = StringFromSBytePointer(XDisplayString(display));
....

or SDL3

....
string title_str = StringFromSBytePointer(SDL_GetWindowTitle(window));
....

And new more functions:

For string[] for sbyte ** like you use delegate *unmanaged[Cdecl]<sbyte **, int, void> or delegate *unmanaged[Cdecl]<sbyte **, int, int> and It works for Game, Application they can load external native library but I have tested with Console.WriteLine() It is successfully. But I never did other like Winfows.Forms or Xlib, SDL3 I will see how does it work for external native libraries.

....
string[] args = StringArrayFromSByteDoublePointers(sArrays, array_length);
....

Warning It is important for [UnmanagedCallerOnly] and it uses sbyte ** and int for array_length If you pass string[] args from Program.cs then you need add SByteDoublePointersFromStringArray

Example:

sbyte **sArrays = SByteDoublePointersFromStringArray(args);
pfnMainFunc(sArrays, args.length);
....

New feature for Alloc, Free and Delete like C/C++

SDL_Renderer *renderer = SDL_CreateRenderer(window, null, SDL_RENDER_ACCELERATOR);
Alloc(renderer);
....
SDL_DestroyRenderer(display);
Delete(renderer);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 161 5/28/2023
3.0.0 138 5/12/2023
2.0.0 139 5/4/2023
1.0.0 161 4/24/2023