Problem with GLFW linking, as it used in SharedLib (DLL)

Environment : Visual Studio 2019.

I’m developing an Engine as a SharedLib (DLL) and I made an example that uses this DLL so I can launch the Engine. at this stage I have to add GLFW library to the engine, so I added GLFW as a submodule (git) to my project and built this library as a StaticLib (.lib) with static runtime sets to “On”. and added GLFW as a reference in the engine as in the second picture below. the build of GLFW goes very well and I get GLFW.lib. so I added some functions of GLFW to the engine code like glfwMakeContextCurrent() at this point when I build the Engine I get weird linking errors for many functions except glfwInit().

here is a picture of an example of one of my linking errors: enter image description here

the project view:

enter image description here

Note: opengl32.lib already added to the engine in the Input in the Linker.

Please if you have any thoughts, I would appreciate it if you can share them


Here is the full linker commandline:

enter image description here


Thank you Everyone for your help. I got relatively a solution and I want to share it with you in case someone fall in the same situation.

Short Answer:

I converted the GLFW from static library to shared library while the building, and the linking errors just gone.

Long Answer

I wrote a Premake script to generate the GLFW project with configuration set to Shared Library and staticruntime to Off [meaning (Multi-threaded DLL (/MD)) for Runtime Library in Visual Studio configuration]. beside some includes and defines (take a look at the script) and I linked the GLFW library to the engine and I copied the .dll to the location of Sandbox/example application based on the engine and everything works pretty fine.

here is the script in case:

project "GLFW"
kind "SharedLib"
language "C"

targetname ("glfw3")
targetdir ("bin/" .. outputdir .. "/%{}")
objdir ("bin-intermediate/" .. outputdir .. "/%{}")



includedirs {

filter "system:windows"
    buildoptions { "-std=c11", "-lgdi32" }
    systemversion "latest"
    staticruntime "Off"




        ("{COPY} %{cfg.buildtarget.relpath} ../../../bin/" .. outputdir .. "/Sandbox")
filter { "system:windows", "configurations:Debug"}
    buildoptions "/MDd"
filter { "system:windows", "configurations:Release"}
    buildoptions "/MD"