I make the interface in C ++ CLI separately from the main logic, which is written in C ++ and is a console application. I launch from CLI with the help

Process^ proc = gcnew Process(); proc->StartInfo->RedirectStandardInput = true; proc->StartInfo->UseShellExecute = false; proc->StartInfo->FileName = "c.exe"; proc->Start(); 

And now the question: what's next? How do I organize communication between them? When I click on a button, what do I need to do to send a request to a child process, how to process it there, and vice versa?

  • Why not to do the interface right away in C ++? What kind of interaction should be implemented? What problem solves the console application? - user227465
  • @GreenDragon don't want to write on WinAPI. There is no other reason. Interaction such as "the user pressed the button - to transfer to the child process the text from the textBox", or "pressed the button - to request the result", etc. - Verm ww
  • Then it’s better to use the library \ framework for C ++ or write directly to C # if you really want .Net. If the information is to be transmitted at runtime - use sockets, if only during the start up - there are enough command line arguments. - user227465
  • I think you need to make a library (dll) with C ++ logic, and not a separate application (process). Further you simply connect this lib to an application on C ++ / CLI. - Alexander Petrov
  • See Interprocess Communication — many methods are listed there. In general, google Inter Process Communication - IPC. - Alexander Petrov

1 answer 1

not sichnik just thinking.
I guess there are two ways to approach

  1. chat with post get
  2. use buffer / shared memory / whatever else it may be called

I would google so C ++ subprocess shared buffer

Creating a Child Process with Redirected Input and Output (Windows)

Sub-processing with modern C ++

Sharing data between Processes in Windows: Named Pipe and Shared Memory

  • Comments are not intended for extended discussion; conversation moved to chat . - Nicolas Chabanovsky