Linking a shared library in dub

maik klein via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 30 18:54:08 PDT 2016


On Thursday, 31 March 2016 at 00:06:19 UTC, maik klein wrote:
> On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote:
>> On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin 
>> wrote:
>>> On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote:
>>>> I want to finally convert my project to windows. That means 
>>>> that I want to build it on windows and linux.
>>>>
>>>> The problem is that I have one external c library 'glfw'. I 
>>>> thought that I would just link with it explicitly but 
>>>> actually I am not completely sure how.
>>>
>>> Try using Derelict based binding
>>>
>>> http://code.dlang.org/packages/derelict-glfw3
>>
>> I am already using the derelict binding but I want to 
>> explicitly link with the .a or .so c lib because I don't have 
>> a package manager on windows.
>
> Okay I think I understand know what you mean, I think you meant 
> I should use dynamic loading like this right?
>
> DerelictGLFW3.load("deps/glfw/build/src/libglfw.so");
>
> This works but I am not sure yet that I want to load it at the 
> application level.

I was able to link with a static lib like this

dependency "derelict-glfw3" version="~>2.0.0"
subConfiguration "derelict-glfw3" "derelict-glfw3-static"
sourceFiles "deps/glfw/build/src/libglfw3.a"
libs "Xi" "pthread" "X11" "Xxf86vm" "Xrandr" "pthread" "GL" "GLU" 
"Xinerama" "Xcursor"



More information about the Digitalmars-d-learn mailing list