Fix export of luaopen_lfs on Windows (#74)

* Make lfs export luaopen_lfs under Windows
This commit is contained in:
Eric Cosatto
2016-06-01 16:52:07 -04:00
committed by Hisham Muhammad
parent 1937ba848b
commit 6e0dc7b27c
2 changed files with 14 additions and 12 deletions

View File

@@ -887,7 +887,7 @@ static const struct luaL_Reg fslib[] = {
{NULL, NULL}, {NULL, NULL},
}; };
int luaopen_lfs (lua_State *L) { LFS_EXPORT int luaopen_lfs (lua_State *L) {
dir_create_meta (L); dir_create_meta (L);
lock_create_meta (L); lock_create_meta (L);
luaL_newlib (L, fslib); luaL_newlib (L, fslib);

View File

@@ -5,27 +5,29 @@
/* Define 'chdir' for systems that do not implement it */ /* Define 'chdir' for systems that do not implement it */
#ifdef NO_CHDIR #ifdef NO_CHDIR
#define chdir(p) (-1) #define chdir(p) (-1)
#define chdir_error "Function 'chdir' not provided by system" #define chdir_error "Function 'chdir' not provided by system"
#else #else
#define chdir_error strerror(errno) #define chdir_error strerror(errno)
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define chdir(p) (_chdir(p)) #define chdir(p) (_chdir(p))
#define getcwd(d, s) (_getcwd(d, s)) #define getcwd(d, s) (_getcwd(d, s))
#define rmdir(p) (_rmdir(p)) #define rmdir(p) (_rmdir(p))
#ifndef fileno #define LFS_EXPORT __declspec (dllexport)
#define fileno(f) (_fileno(f)) #ifndef fileno
#endif #define fileno(f) (_fileno(f))
#endif
#else
#define LFS_EXPORT
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
int luaopen_lfs (lua_State *L); LFS_EXPORT int luaopen_lfs (lua_State *L);
#ifdef __cplusplus #ifdef __cplusplus
} }