mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
Added C# project for calling the different modules
This commit is contained in:
26
LX-Build/LX-API.cs
Normal file
26
LX-Build/LX-API.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LX_Build
|
||||
{
|
||||
internal class LX_API
|
||||
{
|
||||
// Imports SetDllDirectory to change where Dlls are imported from //
|
||||
[DllImport("kernel32.dll", SetLastError = true)]
|
||||
private static extern 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);
|
||||
|
||||
// Sets the directory to import the DLLs from //
|
||||
public static void Init()
|
||||
{
|
||||
#if DEBUG
|
||||
SetDllDirectory("bin\\x64\\Debug");
|
||||
#else
|
||||
SetDllDirectory("bin\\x64\\Release");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
12
LX-Build/LX-Build.csproj
Normal file
12
LX-Build/LX-Build.csproj
Normal file
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>LX_Build</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<BaseOutputPath></BaseOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
16
LX-Build/Main.cs
Normal file
16
LX-Build/Main.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace LX_Build
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Initalises the CPP interface //
|
||||
LX_API.Init();
|
||||
|
||||
// Generates LLVM IR with the example files //
|
||||
_ = LX_API.GenIR("example/main.lx", "example/main.ll", "example/log");
|
||||
}
|
||||
}
|
||||
}
|
||||
8
LX-Build/Properties/launchSettings.json
Normal file
8
LX-Build/Properties/launchSettings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"LX-Build": {
|
||||
"commandName": "Project",
|
||||
"workingDirectory": "$(SolutionDir)"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user