From 6e0dc7b27ce6e8a56d646071b69d7e46c85dd245 Mon Sep 17 00:00:00 2001 From: Eric Cosatto Date: Wed, 1 Jun 2016 16:52:07 -0400 Subject: Fix export of luaopen_lfs on Windows (#74) * Make lfs export luaopen_lfs under Windows --- src/lfs.c | 2 +- src/lfs.h | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lfs.c b/src/lfs.c index 2b85d30..446373c 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -887,7 +887,7 @@ static const struct luaL_Reg fslib[] = { {NULL, NULL}, }; -int luaopen_lfs (lua_State *L) { +LFS_EXPORT int luaopen_lfs (lua_State *L) { dir_create_meta (L); lock_create_meta (L); luaL_newlib (L, fslib); diff --git a/src/lfs.h b/src/lfs.h index a621d04..7f7d2ab 100644 --- a/src/lfs.h +++ b/src/lfs.h @@ -5,27 +5,29 @@ /* Define 'chdir' for systems that do not implement it */ #ifdef NO_CHDIR -#define chdir(p) (-1) -#define chdir_error "Function 'chdir' not provided by system" + #define chdir(p) (-1) + #define chdir_error "Function 'chdir' not provided by system" #else -#define chdir_error strerror(errno) - + #define chdir_error strerror(errno) #endif #ifdef _WIN32 -#define chdir(p) (_chdir(p)) -#define getcwd(d, s) (_getcwd(d, s)) -#define rmdir(p) (_rmdir(p)) -#ifndef fileno -#define fileno(f) (_fileno(f)) -#endif + #define chdir(p) (_chdir(p)) + #define getcwd(d, s) (_getcwd(d, s)) + #define rmdir(p) (_rmdir(p)) + #define LFS_EXPORT __declspec (dllexport) + #ifndef fileno + #define fileno(f) (_fileno(f)) + #endif +#else + #define LFS_EXPORT #endif #ifdef __cplusplus extern "C" { #endif -int luaopen_lfs (lua_State *L); +LFS_EXPORT int luaopen_lfs (lua_State *L); #ifdef __cplusplus } -- cgit v1.2.3-55-g6feb