www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Single D app entered multiple times from command line

reply Brett <Brett gmail.com> writes:
Is there a way too have a single D process run and be called 
multiple times from the command line without too much work?

Basically any time the process is called by the command line it 
will "enter" only one process... and if that process is being 
debugged the entries can be debugged too.

E.g., if I have visual studio running and a BP set in a D app... 
and I then execute the app the BP is hit(rather than the app 
being spawned in a new process and never even being debugged).

I imagine I could potentially create a separate process that has 
a communication layer between it and the D program but I'm hoping 
it would be less work.
Sep 23 2019
parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Monday, 23 September 2019 at 19:14:15 UTC, Brett wrote:
 I imagine I could potentially create a separate process that 
 has a communication layer between it and the D program but I'm 
 hoping it would be less work.
You're pretty much describing a client-server design. A lot of software does work in this way, e.g.: - MS toolchain spawns mspdbsrv to write PDB files - Gradle (Java build tool) spawns a daemon which caches information in memory - Git on Windows also creates long-lived processes to cache filesystem information The simplest design would be for the server to listen on a named pipe (perhaps named after the current directory), and the client to do nothing but forward the command-line arguments and input to the daemon through the pipe, then read back the result and present it to the user.
Sep 23 2019