mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-04 01:49:05 +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
|
*.ll
|
||||||
log
|
log
|
||||||
|
|
||||||
|
# Ignore user specific options #
|
||||||
|
|
||||||
|
.user
|
||||||
|
|||||||
@@ -3,15 +3,17 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace LX_Build
|
namespace LX_Build
|
||||||
{
|
{
|
||||||
internal class LX_API
|
internal partial class LX_API
|
||||||
{
|
{
|
||||||
// Imports SetDllDirectory to change where Dlls are imported from //
|
// Imports SetDllDirectory to change where Dlls are imported from //
|
||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[LibraryImport("kernel32.dll", EntryPoint = "SetDllDirectoryW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
|
||||||
private static extern bool SetDllDirectory(string lpPathName);
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
private static partial bool SetDllDirectory(string lpPathName);
|
||||||
|
|
||||||
// Imports the Frontend of the compiler //
|
// Imports the Frontend of the compiler //
|
||||||
[DllImport("Generator.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
[LibraryImport("Generator.dll", StringMarshalling = StringMarshalling.Custom, StringMarshallingCustomType = typeof(System.Runtime.InteropServices.Marshalling.AnsiStringMarshaller))]
|
||||||
public static extern int GenIR(string arg1, string arg2, string? arg3);
|
[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 //
|
// Sets the directory to import the DLLs from //
|
||||||
public static void Init()
|
public static void Init()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<BaseOutputPath></BaseOutputPath>
|
<BaseOutputPath></BaseOutputPath>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user