Skip to content

Commit 7bc5816

Browse files
committed
Add project files.
1 parent 03629e1 commit 7bc5816

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[*.cs]
2+
3+
# CS8981: The type name only contains lower-cased ascii characters. Such names may become reserved for the language.
4+
dotnet_diagnostic.CS8981.severity = none

DotnetNativeBase.sln

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34330.188
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotnetNativeBase", "DotnetNativeBase\DotnetNativeBase.csproj", "{A2C99A9B-A862-48B0-AAC0-323BAD1FB9DF}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D567AF0-62E8-42C3-8B92-72B00F24DFFC}"
9+
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
11+
EndProjectSection
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|Any CPU = Debug|Any CPU
16+
Release|Any CPU = Release|Any CPU
17+
EndGlobalSection
18+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19+
{A2C99A9B-A862-48B0-AAC0-323BAD1FB9DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{A2C99A9B-A862-48B0-AAC0-323BAD1FB9DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{A2C99A9B-A862-48B0-AAC0-323BAD1FB9DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{A2C99A9B-A862-48B0-AAC0-323BAD1FB9DF}.Release|Any CPU.Build.0 = Release|Any CPU
23+
EndGlobalSection
24+
GlobalSection(SolutionProperties) = preSolution
25+
HideSolutionNode = FALSE
26+
EndGlobalSection
27+
GlobalSection(ExtensibilityGlobals) = postSolution
28+
SolutionGuid = {E6916970-4702-4AA6-BFBD-AA66D350DA94}
29+
EndGlobalSection
30+
EndGlobal
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8+
<Title>DotnetNativeBase</Title>
9+
<Authors>Yotic</Authors>
10+
<Description>A library containing structures for easy use of C# in native build</Description>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<None Include="..\.editorconfig" Link=".editorconfig" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<Using Include="System.Runtime.InteropServices" />
19+
</ItemGroup>
20+
21+
</Project>

DotnetNativeBase/pointer.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[StructLayout(LayoutKind.Sequential)]
2+
public unsafe struct pointer
3+
{
4+
public pointer(nint address) => Address = address;
5+
6+
public nint Address;
7+
8+
public static implicit operator pointer(nint address) => new(address);
9+
public static implicit operator pointer(void* pointer) => new((nint)pointer);
10+
public static implicit operator pointer(void** pointer) => new((nint)pointer);
11+
public static implicit operator pointer(void*** pointer) => new((nint)pointer);
12+
public static implicit operator pointer(delegate* unmanaged<void> ptr) => new((nint)ptr);
13+
14+
public static implicit operator nint(pointer pointer) => pointer.Address;
15+
16+
public static implicit operator void*(pointer pointer) => (void*)pointer.Address;
17+
public static implicit operator void**(pointer pointer) => (void**)pointer.Address;
18+
public static implicit operator void***(pointer Sudden_Reference_To_Bocchi_The_Rock) => (void***)Sudden_Reference_To_Bocchi_The_Rock.Address;
19+
20+
public static implicit operator byte*(pointer pointer) => (byte*)pointer.Address;
21+
public static implicit operator sbyte*(pointer pointer) => (sbyte*)pointer.Address;
22+
public static implicit operator short*(pointer pointer) => (short*)pointer.Address;
23+
public static implicit operator ushort*(pointer pointer) => (ushort*)pointer.Address;
24+
public static implicit operator int*(pointer pointer) => (int*)pointer.Address;
25+
public static implicit operator uint*(pointer pointer) => (uint*)pointer.Address;
26+
public static implicit operator long*(pointer pointer) => (long*)pointer.Address;
27+
public static implicit operator ulong*(pointer pointer) => (ulong*)pointer.Address;
28+
public static implicit operator nint*(pointer pointer) => (nint*)pointer.Address;
29+
public static implicit operator nuint*(pointer pointer) => (nuint*)pointer.Address;
30+
31+
public static implicit operator delegate* unmanaged<void>(pointer pointer) => (delegate* unmanaged<void>)pointer;
32+
}

0 commit comments

Comments
 (0)