dmd.mars
Entry point for DMD.
Discussion
This modules defines the entry point (main) for DMD, as well as 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
- 
  DeclarationboolparseCommandlineAndConfig(size_targc, const(char)**argv, ref Paramparams, ref Stringsfiles);Parses the command line arguments and configuration filesParameterssize_targcNumber of arguments passed via command line const(char)**argvArray of string arguments passed via command line Paramparamsparametes from argvStringsfilesfilesfromargvReturn Valuetrueon faiure
- 
  DeclarationvoidemitMakeDeps(ref Paramparams);Emit the makefile dependencies for the -makedeps switch 
- 
  Declarationintmain(intargc, char**argv);DMD's entry point, C main.DiscussionWithout -lowmem, we need to switch to the bump-pointer allocation scheme right from the start, before any module ctors are run, so we need this hook before druntime is initialized and_Dmainis called.Return ValueReturn code of the application 
- 
  Declarationint_Dmain(char[][]);Manual D main (for druntime initialization), which forwards to tryMain.Return ValueReturn code of the application 
- 
  Declarationvoidgetenv_setargv(const(char)*envvalue, Strings*args);Parses an environment variable containing command-line flags and append them to argsDiscussionThis function is used to read the content of DFLAGS. Flags are separated based on spaces and tabs. Parametersconst(char)*envvalueThe content of an environment variable Strings*argsArray to append the flags to, if any. 
- 
  Declarationconst(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. ParametersStrings*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
- 
  Declarationconst(char)[]parse_conf_arg(Strings*args);Parse command line arguments for the last instance of -conf=path. ParametersStrings*argsCommand line arguments Return ValueThe 'path' in -conf=path, which is the path to the config file to use 
- 
  DeclarationvoidaddDefaultVersionIdentifiers(const ref Paramparams, const ref Targettgt);Add default versionidentifier for dmd, and set the target platform inparamsDiscussionNeeds to be run after all arguments parsing (command line, DFLAGS environment variable and config file) in order to add final flags (such as X86_64or theCRuntimeused).ParametersParamparamswhich target to compile for (set by setTarget())Targettgttarget 
- 
  DeclarationvoidflushMixins();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)
- 
  DeclarationboolparseCommandLine(const ref Stringsarguments, const size_targc, ref Paramparams, ref Stringsfiles, ref Targettarget);Parse command line arguments.DiscussionPrints message(s) if there are errors. ParametersStringsargumentscommand line argumentssize_targcargument count Paramparamsset to result of parsing argumentsStringsfilesset to filespulled fromargumentsTargettargetmore things set to result of parsing argumentsReturn Valuetrueif errors in command line
- 
  DeclarationModulemoduleWithEmptyMain();Return Valuea compiled module (semantic3) containing an empty main() function, for the -main flag