diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-29 11:30:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-29 11:30:16 -0300 |
commit | 1c9c8869741897d67b64a27410f3856d34415e87 (patch) | |
tree | 97e3f28479ce7e333729623abc511cee86544486 /loadlib.c | |
parent | ade585bdf9e286a0ec01796763ded6701c6b1a8f (diff) | |
download | lua-1c9c8869741897d67b64a27410f3856d34415e87.tar.gz lua-1c9c8869741897d67b64a27410f3856d34415e87.tar.bz2 lua-1c9c8869741897d67b64a27410f3856d34415e87.zip |
standard configuration should run out-of-the-box in "any" system
Diffstat (limited to 'loadlib.c')
-rw-r--r-- | loadlib.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: loadlib.c,v 1.21 2005/03/09 16:28:07 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.22 2005/03/18 16:38:43 roberto Exp roberto $ |
3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | ** | 5 | ** |
@@ -44,7 +44,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); | |||
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | #if defined(LUA_USE_DLOPEN) | 47 | #if defined(LUA_DL_DLOPEN) |
48 | /* | 48 | /* |
49 | ** {======================================================================== | 49 | ** {======================================================================== |
50 | ** This is an implementation of loadlib based on the dlfcn interface. | 50 | ** This is an implementation of loadlib based on the dlfcn interface. |
@@ -78,7 +78,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | #elif defined(LUA_USE_DLL) | 81 | #elif defined(LUA_DL_DLL) |
82 | /* | 82 | /* |
83 | ** {====================================================================== | 83 | ** {====================================================================== |
84 | ** This is an implementation of loadlib for Windows using native functions. | 84 | ** This is an implementation of loadlib for Windows using native functions. |
@@ -93,7 +93,7 @@ static void pusherror (lua_State *L) { | |||
93 | char buffer[128]; | 93 | char buffer[128]; |
94 | if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, | 94 | if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, |
95 | NULL, error, 0, buffer, sizeof(buffer), NULL)) | 95 | NULL, error, 0, buffer, sizeof(buffer), NULL)) |
96 | lua_pushstring(L,buffer); | 96 | lua_pushstring(L, buffer); |
97 | else | 97 | else |
98 | lua_pushfstring(L, "system error %d\n", error); | 98 | lua_pushfstring(L, "system error %d\n", error); |
99 | } | 99 | } |
@@ -120,7 +120,7 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | #elif defined(LUA_USE_DYLD) | 123 | #elif defined(LUA_DL_DYLD) |
124 | /* | 124 | /* |
125 | ** {====================================================================== | 125 | ** {====================================================================== |
126 | ** Native Mac OS X / Darwin Implementation | 126 | ** Native Mac OS X / Darwin Implementation |
@@ -212,6 +212,13 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | |||
212 | #define LIB_FAIL "absent" | 212 | #define LIB_FAIL "absent" |
213 | 213 | ||
214 | 214 | ||
215 | #if defined(__ELF__) || defined(__sun) || defined(sgi) || defined(__hpux) | ||
216 | #define DLMSG "your system was not properly installed, " \ | ||
217 | "so it cannot run `loadlib'; check your installation" | ||
218 | #else | ||
219 | #define DLMSG "`loadlib' not supported" | ||
220 | #endif | ||
221 | |||
215 | static void ll_unloadlib (void *lib) { | 222 | static void ll_unloadlib (void *lib) { |
216 | (void)lib; /* to avoid warnings */ | 223 | (void)lib; /* to avoid warnings */ |
217 | } | 224 | } |
@@ -219,14 +226,14 @@ static void ll_unloadlib (void *lib) { | |||
219 | 226 | ||
220 | static void *ll_load (lua_State *L, const char *path) { | 227 | static void *ll_load (lua_State *L, const char *path) { |
221 | (void)path; /* to avoid warnings */ | 228 | (void)path; /* to avoid warnings */ |
222 | lua_pushliteral(L,"`loadlib' not supported"); | 229 | lua_pushliteral(L, DLMSG); |
223 | return NULL; | 230 | return NULL; |
224 | } | 231 | } |
225 | 232 | ||
226 | 233 | ||
227 | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { | 234 | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { |
228 | (void)lib; (void)sym; /* to avoid warnings */ | 235 | (void)lib; (void)sym; /* to avoid warnings */ |
229 | lua_pushliteral(L,"`loadlib' not supported"); | 236 | lua_pushliteral(L, DLMSG); |
230 | return NULL; | 237 | return NULL; |
231 | } | 238 | } |
232 | 239 | ||