www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - libdl issues with DUB

reply "Flamaros" <flamaros.xavier gmail.com> writes:
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.
Dec 17 2013
next sibling parent Marco Leise <Marco.Leise gmx.de> writes:
Am Tue, 17 Dec 2013 13:41:14 +0100
schrieb "Flamaros" <flamaros.xavier gmail.com>:

 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.
More likely you do a one-step build in Mono-D and compile single modules through DUB. Can you post the exact error message please? Does it print libdl or does it complain about undefined dlopen et altera? -- Marco
Dec 17 2013
prev sibling parent reply "yazd" <yazan.dabain gmail.com> writes:
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.
Dec 17 2013
parent "Flamaros" <flamaros.xavier gmail.com> writes:
On Tuesday, 17 December 2013 at 17:05:36 UTC, yazd wrote:
 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.
Thx. It seems to be not the only Issue I got, I have a memory error now. I'll investigate on it.
Dec 17 2013