mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
Used modern approach for C#/C++ interop
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -12,3 +12,7 @@ obj/
|
||||
|
||||
*.ll
|
||||
log
|
||||
|
||||
# Ignore user specific options #
|
||||
|
||||
.user
|
||||
|
||||
@@ -3,15 +3,17 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace LX_Build
|
||||
{
|
||||
internal class LX_API
|
||||
internal partial class LX_API
|
||||
{
|
||||
// Imports SetDllDirectory to change where Dlls are imported from //
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern bool SetDllDirectory(string lpPathName);
|
||||
[LibraryImport("kernel32.dll", EntryPoint = "SetDllDirectoryW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static partial bool SetDllDirectory(string lpPathName);
|
||||
|
||||
// Imports the Frontend of the compiler //
|
||||
[DllImport("Generator.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public static extern int GenIR(string arg1, string arg2, string? arg3);
|
||||
[LibraryImport("Generator.dll", StringMarshalling = StringMarshalling.Custom, StringMarshallingCustomType = typeof(System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller))]
|
||||
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
|
||||
public static partial int GenIR(string arg1, string arg2, string? arg3);
|
||||
|
||||
// Sets the directory to import the DLLs from //
|
||||
public static void Init()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath></BaseOutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user