Difference between revisions of "Linking With Unilink"

From D Wiki
Jump to: navigation, search
(How To: Add Unilink configuration guide)
 
Line 37: Line 37:
 
-zsnn.lib
 
-zsnn.lib
 
-zkernel32;advapi32;user32;wsock32;shell32
 
-zkernel32;advapi32;user32;wsock32;shell32
-LC:\dmd\dmd2\windows\lib
+
-LC:\D\dmd2\windows\lib
-LC:\dm\lib
+
-LC:\D\dm\lib
 
-Go
 
-Go
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 21:42, 13 September 2013

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.