Linking With Unilink

From D Wiki
Jump to: navigation, search

Unilink (also sometimes abbreviated as "ulink") is an alternative closed-source linker which supports linking with DMD's default x86 (32bit) OMF object file format on Windows. Although it has a closed development model, it may work in cases where Optlink would otherwise fail to work, and it can be used to retrieve better diagnostic messages when DMD outputs broken object files.


Unilink can be downloaded from:

The ulnb****.zip file contains the linker (stars encode the version number).

The ulink.chm file in the zip contains the documentation.


Simply extract the contents of the .zip file to a new directory (e.g. C:\ulink).

To be able to link D applications, you need to edit the ulink.cfg file. Here's an example of one:

; ATTENTION: Edit this file or replace it with any file from sample.cfg\*.cfg
# Set to real library search path and uncomment
; -LE:\BCB5\Lib;E:\BCB5\Lib\Release;E:\BCB\Lib\Obj

# Change and uncoment any of next strings if needed

-r -O    # remap import names, bind image

; -Gw    # D6/BCB6 dfm-style

; -Ge    # disable library exports

; -w-cmt # disable compatibility messages

; -o -Gh # Import by ordinal, strip unused PE headers

You may have to edit these paths if you installed your DM and DMD compilers somewhere else.


Unilink is used like similarly to other linkers, pass the names of the object files and library files you want to link to, and by default it will try to produce an executable.

You should consult with the Unilink documentation for more information on how to use the various switches it supports.