aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Cosatto <cosatto@nec-labs.com>2016-06-01 16:52:07 -0400
committerHisham Muhammad <hisham@gobolinux.org>2016-06-01 17:52:07 -0300
commit6e0dc7b27ce6e8a56d646071b69d7e46c85dd245 (patch)
treeab3b2d73d27588810c3c6f232405fa28796eb344
parent1937ba848b275408e837fb49dc8a83eca6a031fe (diff)
downloadluafilesystem-6e0dc7b27ce6e8a56d646071b69d7e46c85dd245.tar.gz
luafilesystem-6e0dc7b27ce6e8a56d646071b69d7e46c85dd245.tar.bz2
luafilesystem-6e0dc7b27ce6e8a56d646071b69d7e46c85dd245.zip
Fix export of luaopen_lfs on Windows (#74)
* Make lfs export luaopen_lfs under Windows
-rw-r--r--src/lfs.c2
-rw-r--r--src/lfs.h24
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[] = {
887 {NULL, NULL}, 887 {NULL, NULL},
888}; 888};
889 889
890int luaopen_lfs (lua_State *L) { 890LFS_EXPORT int luaopen_lfs (lua_State *L) {
891 dir_create_meta (L); 891 dir_create_meta (L);
892 lock_create_meta (L); 892 lock_create_meta (L);
893 luaL_newlib (L, fslib); 893 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 @@
5 5
6/* Define 'chdir' for systems that do not implement it */ 6/* Define 'chdir' for systems that do not implement it */
7#ifdef NO_CHDIR 7#ifdef NO_CHDIR
8#define chdir(p) (-1) 8 #define chdir(p) (-1)
9#define chdir_error "Function 'chdir' not provided by system" 9 #define chdir_error "Function 'chdir' not provided by system"
10#else 10#else
11#define chdir_error strerror(errno) 11 #define chdir_error strerror(errno)
12
13#endif 12#endif
14 13
15#ifdef _WIN32 14#ifdef _WIN32
16#define chdir(p) (_chdir(p)) 15 #define chdir(p) (_chdir(p))
17#define getcwd(d, s) (_getcwd(d, s)) 16 #define getcwd(d, s) (_getcwd(d, s))
18#define rmdir(p) (_rmdir(p)) 17 #define rmdir(p) (_rmdir(p))
19#ifndef fileno 18 #define LFS_EXPORT __declspec (dllexport)
20#define fileno(f) (_fileno(f)) 19 #ifndef fileno
21#endif 20 #define fileno(f) (_fileno(f))
21 #endif
22#else
23 #define LFS_EXPORT
22#endif 24#endif
23 25
24#ifdef __cplusplus 26#ifdef __cplusplus
25extern "C" { 27extern "C" {
26#endif 28#endif
27 29
28int luaopen_lfs (lua_State *L); 30LFS_EXPORT int luaopen_lfs (lua_State *L);
29 31
30#ifdef __cplusplus 32#ifdef __cplusplus
31} 33}