I've run into a peculiar case while compiling and running my test suite for Lua and sol2 using Lua 5.2.4. In my tests, I build a lua_CFunction-containing DLL from source called "my_object". I also build Lua from source in various versions (everything from LuaJIT to Lua 5.3.4).
When I do require("my_object"), it works just fine on all platforms.... EXCEPT on Windows, when I compile Lua 5.2.4 as a static Library, and link that directly into the "my_object" and consuming executable. Code using require("my_object") fails with a runtime error, and the pushed error is a lightuserdata I cannot parse so I can't get any descriptive error out of Lua.
Compiling Lua 5.2.4 as a DLL and linking against the Lua DLL works just fine for the code.
Compiling Lua 5.3/5.1 statically or dynamically and linking against that for the DLL is also fine.