I copied a sample program form manual (the one that runs until escape key has
been pressed). Everything works fine, if I call glfwGetKey form my exe
module. But in my scenario, I have a dll project, where a class CControl is
implemented (derived from interface IControl). CControl has a member
function CControl::GetKey which is a stupid wrapper and happens to do the sole
thing: return glfwGetKey(k), where k is an int passed to CControl::GetKey as
argument. When I get (in my exe module) a pointer to CControl object, and
when I call CControl::GetKey (insted of glfwGetKey), pressing escape key has
no effect.
Thanks for reply. Your advice helped me to solve my problem. I make my dll
projects to use glfw.dll library (GLFW_DLL defined before including
glfw.h).
Apart from that, why statically linked glfw.lib to my dll doesn’t work?
Sorry, I didn’t make myself clear. I managed to compile my dll with glfw.lib
linked,. There is a CControl class defined in my dll. CControl is derived from
abstract class IControl. IControl has a public pure virtual member function
GetKey. GetKey is defined in CControl and just returns the result of a call to
glfwGetKey function. In my exe I get a pointer ptr to IControl object (it’s
static type is CControl) and I “wait” in a loop for escape key
(ptr->GetKey…).
If glfw.lib is linked with my dll, pressing escape key has no effect (as if
escape key released)
If glfwdll.lib is linked with my dll, ptr->GetKey returns value indicating
that escape key was pressed.