Skip to content

Instantly share code, notes, and snippets.

@PetarKirov
Last active February 1, 2021 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PetarKirov/72168d8dc909c670444ca649ec28f80f to your computer and use it in GitHub Desktop.
Save PetarKirov/72168d8dc909c670444ca649ec28f80f to your computer and use it in GitHub Desktop.

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