Tip: Use -i to modify druntime/phobos without rebuilding them
Mathias Lang
pro.mathias.lang at gmail.com
Mon Feb 10 07:03:38 UTC 2020
On Monday, 10 February 2020 at 06:19:44 UTC, Jonathan Marler
wrote:
> Yesterday I wanted to test out some small changes to phobos.
> Rather than building and installing my own version of the
> compiler and libraries, I used a quick hack that allowed me to
> directly change the druntime/phobos source files from my
> current installation and see the results immediately.
>
> In this case I was playing with the "std.process" module in
> phobos. I created a backup of src/phobos/std/process.d and
> started making changes. All I needed to do in order to see
> these changes in my program was to include the "-i=std.process"
> option like this:
>
> dmd -i=std.process myapp.d
>
> A quick and dirty way to selectively change and test changes to
> phobos/druntime on any installed compiler.
>
> For those not familair with -i, the reason this works is that
> the "-i" flag causes all imports to be compiled, except for
> those under the "core", "std" and "etc" module namespaces.
> However, you can override this by explicitly including any one
> of those namespaces.
Doesn't that only work for specific cases involving templates
though ?
If you don't recompile Phobos, anything you'll link will still
link the old binaries. So it's akin to compiling C(++) code but
having the headers not match the `.c(pp)`.
More information about the Digitalmars-d
mailing list