How to link to libdl under linux

Danny Arends Danny.Arends at gmail.com
Sun Dec 15 16:54:30 PST 2013


On Sunday, 15 December 2013 at 21:38:37 UTC, MrSmith wrote:
> I am trying to compile my program which uses derelict under 
> ubuntu 13.10. DerelictUtil needs access to dl library. Simply 
> providing libdl.a as parameter to compiler doesn't work.
>
> deps/derelict-fi-master/lib/libDerelictFI.a(sharedlib_416_4ee.o): 
> In function `_D8derelict4util9sharedlib13LoadSharedLibFAyaZPv':
> /home/andrey/anchovy/deps/derelict-fi-master/../../../.dub/packages/derelict-util-1.0.0/source/derelict/util/sharedlib.d:60: 
> warning: Using 'dlopen' in statically linked applications 
> requires at runtime the shared libraries from the glibc version 
> used for linking
> /usr/lib32/libdl.a(dlopen.o): In function `dlopen':
> (.text+0x1b): undefined reference to `__dlopen'
> /usr/lib32/libdl.a(dlclose.o): In function `dlclose':
> (.text+0x1): undefined reference to `__dlclose'
> /usr/lib32/libdl.a(dlsym.o): In function `dlsym':
> (.text+0x1b): undefined reference to `__dlsym'
> /usr/lib32/libdl.a(dlerror.o): In function `dlerror':
> (.text+0x1): undefined reference to `__dlerror'
> collect2: error: ld returned 1 exit status
> --- errorlevel 1

Pass it depending if you use rdmd or dmd

-L-ldl

or

-ldl

Gr,
Danny Arends
http://www.dannyarends.nl


More information about the Digitalmars-d-learn mailing list