dmd.mars

This modules defines related utilities needed for arguments parsing, path manipulation, etc... This file is not shared with other compilers which use the DMD front-end.

Authors

Walter Bright

Source: mars.d

  • Declaration

    void logo();

    Print DMD's logo on stdout

  • Declaration

    void printInternalFailure(FILE* stream);

    Print DMD's logo with more debug information and error-reporting pointers.

    Parameters

    FILE* stream

    output stream to print the information on

  • Declaration

    void usage();

    Print DMD's usage message on stdout

  • Declaration

    void getenv_setargv(const(char)* envvalue, Strings* args);

    Parses an environment variable containing command-line flags and append them to args.

    Discussion

    This function is used to read the content of DFLAGS. Flags are separated based on spaces and tabs.

    Parameters

    const(char)* envvalue

    The content of an environment variable

    Strings* args

    Array to append the flags to, if any.

  • Declaration

    const(char)[] parse_arch_arg(Strings* args, const(char)[] arch);

    Parse command line arguments for the last instance of -m32, -m64, -m32mscoff or -m32omfobj to detect the desired architecture.

    Parameters

    Strings* args

    Command line arguments

    const(char)[] arch

    Default value to use for architecture. Should be "32" or "64"

    Return Value

    "32", "64" or "32omf" if the "-m32", "-m64", "-m32omf" flags were passed, respectively. If they weren't, return arch.

  • Declaration

    const(char)[] parse_conf_arg(Strings* args);

    Parse command line arguments for the last instance of -conf=path.

    Parameters

    Strings* args

    Command line arguments

    Return Value

    The 'path' in -conf=path, which is the path to the config file to use

  • Declaration

    void setDefaultLibrary(ref Param params, const ref Target target);

    Set the default and debug libraries to link against, if not already set

    Discussion

    Must be called after argument parsing is done, as it won't override any value. Note that if -defaultlib= or -debuglib= was used, we don't override that either.

  • Declaration

    void flushMixins();

    we want to write the mixin expansion file also on error, but there are too many ways to terminate dmd (e.g. fatal() which calls exit(EXIT_FAILURE)), so we can't rely on scope(exit) ... in tryMain() actually being executed so we add atexit(&flushMixins); for those fatal exits (with the GC still valid)

  • Declaration

    bool parseCommandLine(const ref Strings arguments, const size_t argc, ref Param params, ref Strings files, ref Target target);

    Parse command line arguments.

    Discussion

    Prints message(s) if there are errors.

    Parameters

    Strings arguments

    command line arguments

    size_t argc

    argument count

    Param params

    set to result of parsing arguments

    Strings files

    set to files pulled from arguments

    Target target

    more things set to result of parsing arguments

    Return Value

    true if errors in command line

  • Declaration

    Modules createModules(ref Strings files, ref Strings libmodules, const ref Target target);

    Creates the list of modules based on the files provided

    Discussion

    Files are dispatched in the various arrays (global.params.{ddocfiles,dllfiles,jsonfiles,etc...}) according to their extension. Binary files are added to libmodules.

    Parameters

    Strings files

    File names to dispatch

    Strings libmodules

    Array to which binaries (shared/static libs and object files) will be appended

    Target target

    target system

    Return Value

    An array of path to D modules

  • Declaration

    Module moduleWithEmptyMain();

    Return Value

    a compiled module (semantic3) containing an empty main() function, for the -main flag