Difference between revisions of "Linking With Unilink"

From D Wiki
Jump to: navigation, search
m
 
Line 49: Line 49:
  
 
You should consult with the Unilink documentation for more information on how to use the various switches it supports.
 
You should consult with the Unilink documentation for more information on how to use the various switches it supports.
 +
[[Category:HowTo]]

Latest revision as of 10:11, 14 November 2014

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.

Downloading

Unilink can be downloaded from: ftp://ftp.styx.cabel.net/pub/UniLink/

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

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

Installing

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
-zsnn.lib
-zkernel32;advapi32;user32;wsock32;shell32
-LC:\D\dmd2\windows\lib
-LC:\D\dm\lib
-Go

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

Usage

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.