DUB Different Library Name
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 11 22:18:23 PDT 2015
On Sunday, 12 July 2015 at 02:14:06 UTC, serh wrote:
>
> This is what I get when I run "dub" in the directory:
> http://codepad.org/BpnOHVSV
>
> As mentioned, I already have respective Allegro libs installed,
> but as liballegro.so.5.0 instead of liballegro-5.0.so and so on.
> The C++ linker sees them fine, but I am not sure how to make
> dmd/DUB see the correct libraries to link.
This has nothing to do with DMD, DUB, or linking :) Derelict
loads the shared libraries at runtime through the system API
(LoadLibrary on Windows and dlopen elsewhere). Each package has a
default set of library names it looks for. I was under the
impression that liballegro-x.x.so was the common form for
Allegro, so either I was wrong or things are different on Arch.
Regardless, the default library names can be overridden. Just
past the library names you need in the call to load:
```
DerelictAllegro5.load("liballegro.so.5.0");
```
That should do the trick for now. In the meantime, I'll update
the loader to include this form in the default library name list
as soon as I get the chance. Also, I recommend you take a look at
the documentation for using Derelict at [1].
For future reference, when using DUB to manage a project, you
need to be aware of the different kinds of error output.
Sometimes it's from the compiler, sometimes from the linker, and
sometimes from something that happened at run time. In your case,
look at this line:
derelict.util.exception.SharedLibLoadException at ../../../.dub/packages/derelict-util-2.0.0/source/derelict/util/exception.d(35):
The first part, 'derelict.util.exception.SharedLibLoadException'
tells you that this is an exception being thrown by Derelict.
That can only happen at run time.
[1] http://derelictorg.github.io/using.html
More information about the Digitalmars-d-learn
mailing list