Access GLFW functions from DLL


My game uses DLLs as mods. Players can write DLLs which can render, play audio, print to console, etc. This works fine, however when I try to access GLFW functions, they don’t seem to work properly.

CustomMod.cpp (compiled to DLL)

void runDLLCode() {     std::cout << glfwGetKey(Game::getWindow(), GLFW_KEY_A); } 

Game.cpp (compiled to EXE)

void run() {     //Load DLL....       std::cout << glfwGetKey(Game::getWindow(), GLFW_KEY_A); // Prints 1     runDLLCode();                                           // Prints 0 (should print 1 since key is still down)     std::cout << glfwGetKey(Game::getWindow(), GLFW_KEY_A); // Prints 1 } 

Running std::this_thread::get_id() provides the same thread ID across both the DLL and exe.

The address of both Game::getWindow() is the same as well.

Is it possible to have all print 1 when the application is run? Or is it not possible to use GLFW functions across the DLL "wall"?