12.6.3.6 Linker

Generally only one linker is run per target to build a static library, dynamic library, or executable. The id attribute of the linker specifies which type of linking is performed.

  • exe - Overwrites the command for this linker.
<exe name="command" />
  • flag - Adds a single link flag.
<flag value="flag"/>
  • ext - Default extension for generated files - if not overridden by target.

    • value - extension, including ..
<ext value=".ext"/>
  • outflag - Sets the flag for specifying linker output name.

    • value - flag value. Note that it should contain a space character if the actual name should be a separate argument, like -o<space>, or -o/-out: if the name should be appended directly.
<outflag value="-o"/>
  • section - Groups blocks of elements - usually ones that all respect the same if/unless condition.
<section>...</section>
  • libdir - Sets the temporary directory name to build into. This will capture the extra files the compiler generates, then the desired file will be copied to the correct location.
<libdir name="name"/>
  • lib - Adds a library to the link line.

    • name - the complete name is specified.
    • base - the name without a compiler-specific extension (.a/.lib) is specified.
    • hxbase - the name without an extension and architecture (-v7/.iphonesim) is specified.
<lib (name|hxbase|base)="libName" />
  • prefix - Sets the prefix for generated files.

    • value - prefix. This will usually be lib or nothing.
<prefix value="lib"/>
  • ranlib - Specifies whether ranlib needs to be run, and what command to use. Usually used only for Unix-style static libraries.
<ranlib name="ranlib command"/>
  • libpathflag - Sets the flag used for adding library paths to command line. It will be combined with lib entries.
<libpathflag value="-L"/>
  • recreate - Specifies whether to delete the target file before re-running the link command. The archive ar command sometimes adds object files to existing archives, so deleting first can help.
<recreate value="true"/>
  • expandAr - Specifies whether to extract the individual object files from an archive and add these, rather than add the archive as a single library. Can solve some link-order and static-initialization issues, but may make the final executable bigger.
<expandAr value="true"/>
  • fromfile - If the linker supports taking a list of objects in a single file, then this is flag for specifying the file.

    • value - flag for specifying the file. If the filename should be a separate argument, then the flag should end with a space. Usually @ or -filelist . Set to empty to disable.
    • needsQuotes - whether to quote object names in the file.
<fromfile value="flag" needsQuotes="true" />