Making an .exe that executes source file inside itself.

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Apr 25 19:43:31 UTC 2018


On Wednesday, April 25, 2018 19:19:58 BoQsc via Digitalmars-d-learn wrote:
> So there has been idea I've got for around few months now: making
> a software which executable would contain a source file.
> A software that anyone could modify by opening an executable and
> quickly change a few lines of it, rerun an executable, see the
> changes.
>
> Could this be easily possible with D language, considering that
> sources files can be ran without long slow compilation process?

The normal way to do that is to just write a script. In the case of D, you
can just use rdmd to do it. e.g. if you're on a POSIX system, just put

#!/usr/bin/env rdmd

at the top of your .d file and chmod it so that it's executable, and it'll
run like any other script.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list