I'm trying to create a chess program using stockfish as an external executable. I'm using C++ in visual studio 2019 with Windows 10. I need to be able to write commands to stockfish, and read its outputs, all whilst my main program runs normally.
Initially, I tried modifying the source code of stockfish and running it on a separate thread. It partly worked, but became very messy with mutexes and shared data.
Now I'm trying to run it as a separate executable. I found this but this solution uses fork and exec, which seem to only exist on Linux.
I also found this but that is only a solution for C#.
Finally, I found this which looks promising. But it also needs the code in the child program, which would be a problem in and of itself. Also, the code is quite long, so I was wondering if that is really the best way to go about this, or is there was a library that would make this easier?