mirror of
https://github.com/lua/lua
synced 2025-03-23 14:12:52 +03:00
use ANSI versions of DLL functions in Windows
This commit is contained in:
parent
bd262d591f
commit
9f48712c15
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: loadlib.c,v 1.82 2010/03/19 15:02:34 roberto Exp roberto $
|
** $Id: loadlib.c,v 1.83 2010/05/31 16:34:19 roberto Exp roberto $
|
||||||
** Dynamic library loader for Lua
|
** Dynamic library loader for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
**
|
**
|
||||||
@ -145,7 +145,7 @@ static void setprogdir (lua_State *L) {
|
|||||||
char buff[MAX_PATH + 1];
|
char buff[MAX_PATH + 1];
|
||||||
char *lb;
|
char *lb;
|
||||||
DWORD nsize = sizeof(buff)/sizeof(char);
|
DWORD nsize = sizeof(buff)/sizeof(char);
|
||||||
DWORD n = GetModuleFileName(NULL, buff, nsize);
|
DWORD n = GetModuleFileNameA(NULL, buff, nsize);
|
||||||
if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
|
if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
|
||||||
luaL_error(L, "unable to get ModuleFileName");
|
luaL_error(L, "unable to get ModuleFileName");
|
||||||
else {
|
else {
|
||||||
@ -159,7 +159,7 @@ static void setprogdir (lua_State *L) {
|
|||||||
static void pusherror (lua_State *L) {
|
static void pusherror (lua_State *L) {
|
||||||
int error = GetLastError();
|
int error = GetLastError();
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
|
if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, error, 0, buffer, sizeof(buffer), NULL))
|
NULL, error, 0, buffer, sizeof(buffer), NULL))
|
||||||
lua_pushstring(L, buffer);
|
lua_pushstring(L, buffer);
|
||||||
else
|
else
|
||||||
@ -172,7 +172,7 @@ static void ll_unloadlib (void *lib) {
|
|||||||
|
|
||||||
|
|
||||||
static void *ll_load (lua_State *L, const char *path, int seeglb) {
|
static void *ll_load (lua_State *L, const char *path, int seeglb) {
|
||||||
HMODULE lib = LoadLibraryEx(path, NULL, LUA_LLE_FLAGS);
|
HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS);
|
||||||
(void)(seeglb); /* symbols are 'global' by default? */
|
(void)(seeglb); /* symbols are 'global' by default? */
|
||||||
if (lib == NULL) pusherror(L);
|
if (lib == NULL) pusherror(L);
|
||||||
return lib;
|
return lib;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user