Skip to content

Commit

Permalink
avoid MSVC build error
Browse files Browse the repository at this point in the history
```
Microsoft (R) Incremental Linker Version 14.00.24241.7
Copyright (C) Microsoft Corporation.  All rights reserved.
io.def : error LNK2001: unresolved external symbol luaopen_compat53_io
compat53/io.lib : fatal error LNK1120: 1 unresolved externals
Error: Build error: Failed compiling module compat53/io.dll
```
  • Loading branch information
hishamhm committed Aug 29, 2024
1 parent 0c9acd4 commit 627d3bb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lprefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ LUAMOD_API int luaopen_compat53_string (lua_State *L) {
# endif

/* choose which popen implementation to pick */
# if defined(_MSC_VER)
# define LUA_USE_WINDOWS 1
# endif
# if (!defined(LUA_USE_WINDOWS) && !defined(LUA_USE_POSIX)) && \
((defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || \
Expand Down Expand Up @@ -242,21 +245,24 @@ static void createmeta (lua_State *L);
# undef LUA_FILEHANDLE
# define LUA_FILEHANDLE COMPAT53_LUA_PFILEHANDLE

LUAMOD_API int luaopen_compat53_io (lua_State *L) {
luaL_Reg const funcs[] = {

/* for PUC-Rio Lua 5.1 only */
# if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM == 501 && !defined(LUA_JITLIBNAME)

LUAMOD_API int luaopen_compat53_io (lua_State *L) {
luaL_Reg const funcs[] = {
{ "popen", io_popen },
{ "type", io_ptype },

# endif /* for PUC-Rio Lua 5.1 only */

{ NULL, NULL }
};
luaL_newlib(L, funcs);
createmeta(L);
return 1;
}

# endif /* for PUC-Rio Lua 5.1 only */

/* fake CLANG feature detection on other compilers */
# ifndef __has_attribute
Expand Down

0 comments on commit 627d3bb

Please sign in to comment.