mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
FFI: Change ffi.load() library name resolution for Cygwin.
This commit is contained in:
parent
9589e11e44
commit
339142c2aa
@ -39,21 +39,38 @@ LJ_NORET LJ_NOINLINE static void clib_error_(lua_State *L)
|
||||
|
||||
#define clib_error(L, fmt, name) clib_error_(L)
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
#define CLIB_SOPREFIX "cyg"
|
||||
#else
|
||||
#define CLIB_SOPREFIX "lib"
|
||||
#endif
|
||||
|
||||
#if LJ_TARGET_OSX
|
||||
#define CLIB_SOEXT "%s.dylib"
|
||||
#elif defined(__CYGWIN__)
|
||||
#define CLIB_SOEXT "%s.dll"
|
||||
#else
|
||||
#define CLIB_SOEXT "%s.so"
|
||||
#endif
|
||||
|
||||
static const char *clib_extname(lua_State *L, const char *name)
|
||||
{
|
||||
if (!strchr(name, '/')) {
|
||||
if (!strchr(name, '/')
|
||||
#ifdef __CYGWIN__
|
||||
&& !strchr(name, '\\')
|
||||
#endif
|
||||
) {
|
||||
if (!strchr(name, '.')) {
|
||||
name = lj_str_pushf(L, CLIB_SOEXT, name);
|
||||
L->top--;
|
||||
#ifdef __CYGWIN__
|
||||
} else {
|
||||
return name;
|
||||
#endif
|
||||
}
|
||||
if (!(name[0] == 'l' && name[1] == 'i' && name[2] == 'b')) {
|
||||
name = lj_str_pushf(L, "lib%s", name);
|
||||
if (!(name[0] == CLIB_SOPREFIX[0] && name[1] == CLIB_SOPREFIX[1] &&
|
||||
name[2] == CLIB_SOPREFIX[2])) {
|
||||
name = lj_str_pushf(L, CLIB_SOPREFIX "%s", name);
|
||||
L->top--;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user