mirror of
https://github.com/tonytins/cstdotnet.git
synced 2026-02-10 12:14:47 -05: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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue