Skip to content

Instantly share code, notes, and snippets.

@PetarKirov
Last active Feb 1, 2021
Embed
What would you like to do?

Example usage

➤ ./test.d --first arg --second arg2
["--first", "arg", "--second", "arg2"]
#!/usr/bin/env bash
src_dir="$(dirname "$0")/src"
# The options `-defaultlib=libphobos2.so` and `-L-fuse-ld=gold`
# make the compilation almost twice as fast in many situations.
#
# Explanation:
# * ld.gold is in general a faster linker than the default one - ld.bfd
# * Using the standard library Phobos as a shared library, means there a lot
# less work for the linker in the first place
dmd -mv=build_scripts="$src_dir" \
-defaultlib=libphobos2.so -L-fuse-ld=gold \
-i -run "$1" "${@:2}"
#!/usr/bin/env -S sh -c '$(dirname $0)/dmd.sh $0 $@'
// `/usr/bin/env -S` is supported by coreutils 8.30 or newer:
// https://lists.gnu.org/archive/html/coreutils-announce/2018-07/msg00000.html
void main(string[] args)
{
import std.stdio : writeln;
args[1 .. $].writeln;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment