cwinapierror-handlingcompiler-constructionide

What is the proper way to retrieve error handling from a compiler to an ide?


I have written my own programming language and have finished the self hosting compiler for it. I am now writing the ide frontend in windows for this compiler backend.

The issue is I created all the error handling in the compiler backend so now that I am creating the ide for this compiler I don't understand how they are suppose to communicate. An ide is suppose to execute the compiler when the run button is pressed, then pass the files that were created in the ide, to the compiler to be parsed and compiled. That's seems pretty straightforward but how do we retrieve the errors from that compiler if there are any? I would think that the errors would somehow need to be passed back to the ide so that we can display that in an error or output window.

So what is the proper way to retrieve error handling from a compiler to an ide?


Solution

  • The usual way is via a command line and standard output.

    Specify arguments to the sub-process on the command line and pass a STARTUPINFO parameter to CreateProcess, set STARTF_USESTDHANDLES in dwFlags and set the hStdOutput and hStdError handles as appropriate.

    In the sub-process use those handles to write whatever information the parent needs.

    When the sub-process is done use those handles to read whatever the process wrote.

    This assumes the usual non-interactive compiler process, that you simply set it running and it does work then returns without taking user input.