Re: Static lib Linker error under win32

  • From: Mike Pall <mike-1208@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 2 Aug 2012 21:31:39 +0200

rob wrote:
> I'm currently trying to embed a static LuaJit library under win32
> into one of my applications, however I get unresolved linker errors.
> Tested it using Visual Studio 2010 and 2012, plus MinGW. For visual
> studio the unresolved symbols are: '___security_cookie',
> '@__security_check_cookie', '__imp____iob_func', '__imp___fseeki64',
> '__imp___ftelli64', '__imp___time64', '__imp___gmtime64',
> '__imp___localtime64', '__imp___mktime64', '__imp___difftime64', and
> '___report_rangecheckfailure'.

This looks like it was miscompiled or you're compiling the library
and the executable with different options. Try:
  msvcbuild static

> For MinGW they are: '__Unwind_GetCFA', '__Unwind_DeleteException',
> '___umoddi3', '___udivdi3', '_fseeko64', '___divdi3', and
> '___moddi3'.

Umm, you're not including libgcc in your static link?

> I'm also wondering, the Lua Jit install page says: "You may link
> LuaJIT statically on Windows only if you don't intend to load Lua/C
> modules at runtime."
> Does this mean that 'require' does not work the same way as the
> standard Lua version?

You get the same problem with Lua if you link it statically on
Windows. You can't load C extension modules anymore with require,
because those modules are bound to lua51.dll. A static build
doesn't have it and dragging in two copies of the runtime would
certainly crash (one statically linked in the executable and
another in the DLL).

--Mike

Other related posts: