mirror of
https://github.com/tonytins/cstdotnet.git
synced 2025-07-04 21:50:27 -04:00
Preliminary support for .NET 8
- Native compatibility - Parser can now be consumed from non-.NET programming languages
This commit is contained in:
parent
5f6e6c1935
commit
df7197609d
3 changed files with 25 additions and 7 deletions
|
@ -1,5 +1,8 @@
|
|||
// This project is licensed under the BSD 3-Clause license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
#if NET8_0
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
|
||||
namespace CSTNet;
|
||||
|
||||
|
@ -30,6 +33,16 @@ public class CST
|
|||
return GetEntry(entries, key);
|
||||
}
|
||||
|
||||
#if NET8_0
|
||||
[UnmanagedCallersOnly(EntryPoint = "parse")]
|
||||
public static IntPtr Parse(IntPtr content, IntPtr key)
|
||||
{
|
||||
// => Parse(Marshal.PtrToStringAnsi(content), Marshal.PtrToStringAnsi(key));
|
||||
var entries = NormalizeEntries(Marshal.PtrToStringAnsi(content));
|
||||
return Marshal.StringToHGlobalAnsi(GetEntry(entries, Marshal.PtrToStringAnsi(key)));
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the document's line endings with the native system line endings.
|
||||
/// </summary>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;netstandard2.1;net8.0</TargetFrameworks>
|
||||
<Version>2.0.103</Version>
|
||||
<Version>2.0.200-beta1</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
@ -17,4 +17,9 @@
|
|||
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Support AOT on .NET 8+ -->
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
|
||||
<IsAotCompatible>true</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue