Skip to content

Commit 882594c

Browse files
author
Jens K. Mueller
committed
Use pragma(lib, "dl") instead of compile argument
1 parent 4629c7e commit 882594c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ Usage
1919
Posix systems (Linux, Mac OSX, FreeBSD, etc.)
2020
---------------------------------------------
2121

22-
$ dmd path/to/ddl.d /path/to/libdl.a -L-ldl your_module.d
22+
$ dmd path/to/ddl.d -L-ldl your_module.d
2323

24-
Note, that libdl must be linked statically and dynamically.
24+
Note, that libdl must be also linked dynamically. It is linked already
25+
statically using pragma(lib, "dl").
2526

2627
Windows
2728
-------
@@ -39,8 +40,8 @@ your system.
3940
Unfortunately the tests are not portable. So be prepared for seeing them fail on
4041
your system.
4142

42-
$ dmd -unittest -version=ddl -Ipath/to/ddl/tests /path/to/libdl.a -L-ldl path/to/ddl.d -run tests/test_c.d
43-
$ dmd -unittest -version=ddl -Ipath/to/ddl/tests /path/to/libdl.a -L-ldl path/to/ddl.d -run tests/test_zmq.d
43+
$ dmd -unittest -version=ddl -Ipath/to/ddl/tests -L-ldl path/to/ddl.d -run tests/test_c.d
44+
$ dmd -unittest -version=ddl -Ipath/to/ddl/tests -L-ldl path/to/ddl.d -run tests/test_zmq.d
4445

4546
Note this also runs ddl's unittests. Further, ```-version=ddl``` is needed to
4647
verify the example in the [documentation](http://jkm.github.com/ddl/ddl.html).

src/ddl.d

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ import std.exception;
230230
import std.conv;
231231
import std.path;
232232
import std.array;
233-
version(Posix) import core.sys.posix.dlfcn;
233+
version(Posix)
234+
{
235+
import core.sys.posix.dlfcn;
236+
pragma(lib, "dl"); // link statically
237+
}
234238
version(Windows) import core.sys.windows.windows, std.windows.syserror;
235239
debug import std.stdio;
236240

0 commit comments

Comments
 (0)