Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
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:
License:
Source mars.d
Documentation https://dlang.org/phobos/dmd_mars.html
- void
logo(); - Print DMD's logo on stdout
- void
printInternalFailure(FILE*stream); - Print DMD's logo with more debug information and error-reporting pointers.Parameters:
FILE* streamoutput stream to print the information on - void
usage(); - Print DMD's usage message on stdout
- bool
generateJson(ref Modulesmodules, ErrorSinkeSink); - Generate JSON file.Parameters:
Modules modulesModules ErrorSink eSinkerror message sink Returns:true on error - void
getenv_setargv(const(char)*envvalue, Strings*args); - Parses an environment variable containing command-line flags and append them to
args.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. - const(char)[]
parse_arch_arg(Strings*args, const(char)[]arch); - Parse command line arguments for the last instance of -m32, -m64, -m32mscoff to detect the desired architecture.Parameters:
Strings* argsCommand line arguments const(char)[] archDefault value to use for architecture. Should be "32" or "64" Returns:"32", or "64" if the "-m32", "-m64" flags were passed, respectively. If they weren't, returnarch. - const(char)[]
parse_conf_arg(Strings*args); - Parse command line arguments for the last instance of -conf=path.Parameters:
Strings* argsCommand line arguments Returns:The 'path' in -conf=path, which is the path to the config file to use - pure @safe void
setDefaultLibraries(ref const Targettarget, ref const(char)[]defaultlibname, ref const(char)[]debuglibname); - Set the default and debug libraries to link against, if not already setMust 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.Parameters:
Target targetparameters set by user const(char)[] defaultlibnameset based on targetconst(char)[] debuglibnameset based on target - 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)
- bool
parseCommandLine(ref const Stringsarguments, const size_targc, ref Paramparams, ref Stringsfiles, ref Targettarget, ref DMDparamsdriverParams, ErrorSinkeSink); - Parse command line arguments.Prints message(s) if there are errors.Parameters:
Strings argumentscommand line arguments size_t argcargument count Param paramsset to result of parsing argumentsStrings filesset to files pulled from argumentsTarget targetmore things set to result of parsing argumentsDMDparams driverParamseven more things to set ErrorSink eSinkerror sink Returns:true if errors in command line - bool
createModules(ref Stringsfiles, ref Stringslibmodules, ref Paramparams, ref const Targettarget, ErrorSinkeSink, ref Modulesmodules); - Creates the list of modules based on the files providedFiles are dispatched in the various arrays (global.params.{ddocfiles,dllfiles,jsonfiles,etc...}) according to their extension. Binary files are added to libmodules.Parameters:
Strings filesFile names to dispatch Strings libmodulesArray to which binaries (shared/static libs and object files) will be appended Param paramscommand line params Target targettarget system ErrorSink eSinkerror message sink Modules modulesempty array of modules to be filled in Returns:true on error - Module
moduleWithEmptyMain(); - Returns:a compiled module (semantic3) containing an empty main() function, for the -main flag
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Mon Mar 31 10:27:41 2025