c generator

This commit is contained in:
nub31
2025-10-16 13:44:19 +02:00
parent 4ca2b39652
commit f7f32b8d23
11 changed files with 814 additions and 117 deletions

View File

@@ -27,4 +27,28 @@ public static class GCC
return process.ExitCode == 0;
}
public static async Task<bool> Compile(string cPath, string outPath)
{
using var process = new Process();
process.StartInfo = new ProcessStartInfo("gcc", ["-ffreestanding", "-nostartfiles", "-c", "-o", outPath, cPath])
{
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
};
process.Start();
await process.WaitForExitAsync();
var errors = await process.StandardError.ReadToEndAsync();
if (!string.IsNullOrWhiteSpace(errors))
{
await Console.Error.WriteLineAsync(errors);
}
return process.ExitCode == 0;
}
}