-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Hi,
I'm trying to install Lrexlib-PCRE with luarocks under Windows (with the help of vcpkg).
When running 'luarocks install Lrexlib-PCRE' I get the following message:
src/pcre/lpcre.c(451): error C2491: 'luaopen_rex_pcre': definition of dllimport function not allowed
The line 451 is:
REX_API int REX_OPENLIB (lua_State *L) {
REX_API is defined as a synonym for LUALIB_API (common.h)
#ifndef REX_API
# define REX_API LUALIB_API
#endif
LUALIB_API is a synonym for LUA_API (luaconf.h):
#define LUALIB_API LUA_API
The problem is that (under Windows) LUA_API is a conditional define (luaconf.h):
#if defined(LUA_CORE) || defined(LUA_LIB) /* { */
#define LUA_API __declspec(dllexport)
#else /* }{ */
#define LUA_API __declspec(dllimport)
#endif /* } */
Lua compiled modules should define LUA_LIB before including any lua header file so that LUA_API is correctly defined (__declspec(dllexport) will export the entry point)
With a very small change in the rockspec I managed to compile
before:
defines = {
"VERSION=\"2.9.1\"",
"PCRE2_CODE_UNIT_WIDTH=8",
},
after:
defines = {
"LUA_LIB=",
"VERSION=\"2.9.1\"",
"PCRE2_CODE_UNIT_WIDTH=8",
},
Can you update the rockspec ?
Metadata
Metadata
Assignees
Labels
No labels