Static link of glfw3 library fails for me

John Burton john.burton at jbmail.com
Mon Jul 27 07:30:42 UTC 2020


On Sunday, 26 July 2020 at 12:24:06 UTC, John Burton wrote:
> On Sunday, 26 July 2020 at 10:41:27 UTC, Mike Parker wrote:
>> On Sunday, 26 July 2020 at 08:28:29 UTC, John Burton wrote:
>>
>>
>>> And I get the following errors from the link :-
>>>
>>> lld-link: error: undefined symbol: __GSHandlerCheck
>>> lld-link: error: undefined symbol: __security_check_cookie
>>> lld-link: error: undefined symbol: __security_cookie
>>
>> I believe that's because the GLFW library was compiled with 
>> the Microsoft compiler's /GS option:
>>

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 :)




More information about the Digitalmars-d-learn mailing list