Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
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

Entry point for DMD.
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.
Authors:
Walter Bright
License:
Boost License 1.0

Source mars.d

Documentation https://dlang.org/phobos/dmd_mars.html

Coverage https://codecov.io/gh/dlang/dmd/src/master/src/dmd/mars.d

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

int `main`(int `argc`, char** `argv`);
  DMD's entry point, C main.
  Without -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 _Dmain is called.
  Returns:
  Return code of the application
int `_Dmain`(char[][]);
  Manual D main (for druntime initialization), which forwards to tryMain.
  Returns:
  Return code of the application
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)* `envvalue` | The content of an environment variable
  Strings* `args` | Array 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 or -m32mscoff 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"

  Returns:
  "32", "64" or "32mscoff" if the "-m32", "-m64", "-m32mscoff" flags were passed, respectively. If they weren't, return `arch`.
const(char)[] `parse_conf_arg`(Strings* `args`);
  Parse command line arguments for the last instance of -conf=path.
  Parameters:

  Strings* `args` | Command line arguments

  Returns:
  The 'path' in -conf=path, which is the path to the config file to use
void `setTarget`(ref Param `params`);
  Set the is target fields of `params` according to the TARGET value.
  Parameters:

  Param `params` | where the is fields are

void `addDefaultVersionIdentifiers`(ref const Param `params`);
  Add default version identifier for dmd, and set the target platform in `params`. https://dlang.org/spec/version.html#predefined-versions
  Needs to be run after all arguments parsing (command line, DFLAGS environment variable and config file) in order to add final flags (such as X86_64 or the CRuntime used).
  Parameters:

  Param `params` | which target to compile for (set by setTarget())

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 Strings `arguments`, const size_t `argc`, ref Param `params`, ref Strings `files`);
  Parse command line arguments.
  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`

  Returns:
  true if errors in command line
Modules `createModules`(ref Strings `files`, ref Strings `libmodules`);
  Creates the list of modules based on the files provided
  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

  Returns:
  An array of path to D modules

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Mon May 11 10:58:08 2020