Thread overview
Interacting between two different programs
Jun 29, 2013
Jeremy DeHaan
Jun 29, 2013
yaz
Jun 29, 2013
Jeremy DeHaan
Jun 29, 2013
Anthony J Bonkoski
June 29, 2013
I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code Blocks and Visual Studio, and various other IDE's interact with debuggers as if it isn't some external thing.

How does someone have one program interact with another like this? Can you have one send its output to the other's input? Do they somehow share the same IO's? I've never had to write code that does anything like this so I'm you great minds out there can shed some light.

Thanks in advance!
June 29, 2013
On Saturday, 29 June 2013 at 06:08:28 UTC, Jeremy DeHaan wrote:
> I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code Blocks and Visual Studio, and various other IDE's interact with debuggers as if it isn't some external thing.
>
> How does someone have one program interact with another like this? Can you have one send its output to the other's input? Do they somehow share the same IO's? I've never had to write code that does anything like this so I'm you great minds out there can shed some light.
>
> Thanks in advance!

You can use std.phobos.pipeProcess to interact with an external process that you spawn. This works by connecting the standard streams between the child and parent processes, so that they can send and receive data.
GDB provides an interface that can be used with this kind of intercommunication. It is called GDB MI. You can read about it here http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_211.html#SEC216
June 29, 2013
On Saturday, 29 June 2013 at 06:08:28 UTC, Jeremy DeHaan wrote:
> I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code Blocks and Visual Studio, and various other IDE's interact with debuggers as if it isn't some external thing.
>
> How does someone have one program interact with another like this? Can you have one send its output to the other's input? Do they somehow share the same IO's? I've never had to write code that does anything like this so I'm you great minds out there can shed some light.
>
> Thanks in advance!

At a more fundamental level, you might want to read about fork(), pipe(), execlp()  UNIX-style system calls. Here's a nice document: http://www.makelinux.net/alp/038. Given, this is Unix-specific and Windows will be much different. However, you'll find this low-level understanding useful when using the higher-level APIs.
June 29, 2013
On Saturday, 29 June 2013 at 07:45:01 UTC, yaz wrote:
> On Saturday, 29 June 2013 at 06:08:28 UTC, Jeremy DeHaan wrote:
>> I've been toying around with the idea of working on an IDE, mostly because I think it would be an interesting/fun project to work on. In any case, the only thing I cannot seem to wrap my head around is how programs like Code Blocks and Visual Studio, and various other IDE's interact with debuggers as if it isn't some external thing.
>>
>> How does someone have one program interact with another like this? Can you have one send its output to the other's input? Do they somehow share the same IO's? I've never had to write code that does anything like this so I'm you great minds out there can shed some light.
>>
>> Thanks in advance!
>
> You can use std.phobos.pipeProcess to interact with an external process that you spawn. This works by connecting the standard streams between the child and parent processes, so that they can send and receive data.
> GDB provides an interface that can be used with this kind of intercommunication. It is called GDB MI. You can read about it here http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_211.html#SEC216


This was exactly what I was looking for, thanks!

And thank you as well, Anthony. This is a lot of good information.