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.
License
Source: mars.d
Documentation: https://dlang.org/phobos/dmd_mars.html
-
Declaration
voidlogo();Print DMD's
logoon stdout -
Declaration
voidprintInternalFailure(FILE*stream);Print DMD's logo with more debug information and error-reporting pointers.
Parameters
FILE*streamoutput
streamto print the information on -
Declaration
voidusage();Print DMD's
usagemessage on stdout -
Declaration
voidgetenv_setargv(const(char)*envvalue, Strings*args);Parses an environment variable containing command-line flags and append them to
.argsDiscussion
This function is used to read the content of DFLAGS. Flags are separated based on spaces and tabs.
Parameters
const(char)*envvalueThe content of an environment variable
Strings*argsArray 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*argsCommand line arguments
const(char)[]archDefault 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*argsCommand line arguments
Return Value
The 'path' in -conf=path, which is the path to the config file to use
-
Declaration
voidsetDefaultLibrary(ref Paramparams, const ref Targettarget);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
voidflushMixins();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
boolparseCommandLine(const ref Stringsarguments, const size_targc, ref Paramparams, ref Stringsfiles, ref Targettarget);Parse command line
arguments.Discussion
Prints message(s) if there are errors.
Parameters
Stringsargumentscommand line
argumentssize_targcargument count
Paramparamsset to result of parsing
argumentsStringsfilesset to
filespulled fromargumentsTargettargetmore things set to result of parsing
argumentsReturn Value
trueif errors in command line -
Declaration
ModulescreateModules(ref Stringsfiles, ref Stringslibmodules, const ref Targettarget);Creates the list of modules based on the
filesprovidedDiscussion
Files are dispatched in the various arrays (global.params.{ddocfiles,dllfiles,jsonfiles,etc...}) according to their extension. Binary
filesare added tolibmodules.Parameters
StringsfilesFile names to dispatch
StringslibmodulesArray to which binaries (shared/static libs and object
files) will be appendedTargettargettargetsystemReturn Value
An array of path to D modules
-
Declaration
ModulemoduleWithEmptyMain();Return Value
a compiled module (semantic3) containing an empty main() function, for the -main flag