Static link of glfw3 library fails for me

John Burton john.burton at jbmail.com
Mon Jul 27 10:22:41 UTC 2020


On Monday, 27 July 2020 at 08:53:25 UTC, Mike Parker wrote:
> On Monday, 27 July 2020 at 07:30:42 UTC, John Burton wrote:
>
>> For reference I got this to work by doing the following :-
>>
>> 1) Installed visual studio build tools. I could not get this 
>> to work at all with the linker etc that comes with ldc2.
>> 2) Copied the glfw3.lib vs2019 version file into my build 
>> directory (obviously could point the linker at it too which 
>> would be better)
>> 3) Used the following dub.sdl
>>
>> name "game"
>> description "Test Project"
>> authors "Me"
>> copyright "Copyright ┬® 2020, Me"
>> license "proprietary"
>> dependency "bindbc-glfw" version="~>0.10.0"
>> dflags "-mscrtlib=ucrt"
>> libs "glfw3"
>> versions "BindGLFW_Static"
>>
>> The key seems to be using the dflags line to make it link with 
>> the "modern" C libraries, and using the microsoft linker.
>>
>> I appear to have glfw3 statically linked and working :)
>
> Cool. To be clear, you're still compiling with LDC, correct? 
> I'm pretty sure DMD is using the universal C runtime out of the 
> box when VS is installed.

yes compiling with LDC (Installed via "scoop" (see 
https://scoop.sh) but I don't think that matter where it came 
from).

I got it previously to work with DMD with no issue, my issue was 
with LDC only.
I was using DMD for my project previously but started doing 
something where performance mattered so thought to use LDC 
instead.


More information about the Digitalmars-d-learn mailing list