libdl issues with DUB

yazd yazan.dabain at gmail.com
Tue Dec 17 09:05:35 PST 2013


On Tuesday, 17 December 2013 at 12:41:16 UTC, Flamaros wrote:
> When I build our project with DUB under linux I get some link 
> errors about libdl, that is messing.
> In my main I have the following lines :
>
> version(Posix)
> {
>     pragma(lib, "dl");
> }
>
> This works well with MonoD, so it seems like version Posix 
> isn't defined with DUB or pragma ignored.

You'll need to add this to your package file:

"libs-posix": ["dl"]

Check the documentation here for more information 
http://code.dlang.org/package-format#build-settings

The reason this works on DMD is that it builds and links the 
executable in one step.
Dub separates that to two steps. And so this pragma will be 
useless.


More information about the Digitalmars-d-learn mailing list