public static void Main(string[] args) { Channel channel = new Channel("127.0.0.1:30051", ChannelCredentials.Insecure); var client = new Greeter.GreeterClient(channel); String user = "******"; var reply = client.Compile(new HelloRequest { ClangFilePath = "5", LldPath = "5", MasmPath = "8", CompilationFlags = "9", LinkerFlags = "10" }); Console.WriteLine("Greeting: " + reply.Message); channel.ShutdownAsync().Wait(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
void Link(SourceFile sourceFile) { SaveOpenedFiles(); var thread = new System.Threading.Thread(() => { try { if (!IsWindbgPluginLoaded()) { throw new Exception("windbg plugin is not loaded - please load it first."); } else { AddTextToOutputWindow("Sending blink request to windbg plugin."); } Channel channel = new Channel("127.0.0.1:30051", ChannelCredentials.Insecure); var client = new Greeter.GreeterClient(channel); string compilationFlags = ""; foreach (var include in sourceFile.IncludePaths) { var newInclude = include; if (newInclude.EndsWith("\\")) { newInclude = include.Substring(0, include.Length - 1); } compilationFlags += "/imsvc\"" + newInclude + "\"" + " "; } foreach (var define in sourceFile.Macros) { compilationFlags += "/D\"" + define + "\"" + " "; } compilationFlags += sourceFile.LanguageStandard + " "; JoinableTaskFactory.Run(async() => { var reply = client.Compile(new LinkCommandRequest { ClangFilePath = Environment.ExpandEnvironmentVariables(@"%BSOD_SURVIVOR_DIR%\bin\clang-cl.exe"), LdPath = Environment.ExpandEnvironmentVariables(@"%BSOD_SURVIVOR_DIR%\bin\lld-link.exe"), MasmPath = @"ml64.exe", CompilationFlags = compilationFlags, FilePath = sourceFile.FilePath, LinkerFlags = "", ObjCopyPath = Environment.ExpandEnvironmentVariables(@"%BSOD_SURVIVOR_DIR%\bin\llvm-objcopy.exe") }); while (await reply.ResponseStream.MoveNext()) { if (reply.ResponseStream.Current.IsLogging) { AddTextToOutputWindow(reply.ResponseStream.Current.Message); } else { if (!reply.ResponseStream.Current.Success) { throw new Exception(String.Format("Failed to link {0} with error:\n {1}", sourceFile.FilePath, reply.ResponseStream.Current.Message)); } } } AddTextToOutputWindow("Link succeeded"); MessageBox.Show("Linking succeeded"); }); } catch (Exception e) { AddTextToOutputWindow(e.Message); MessageBox.Show("Linking failed, please see output window for more details."); } }); thread.Start(); }