mirror of https://github.com/lua/lua
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
|
||||
** See Copyright Notice in lua.h
|
||||
**
|
||||
|
@ -145,7 +145,7 @@ static void setprogdir (lua_State *L) {
|
|||
char buff[MAX_PATH + 1];
|
||||
char *lb;
|
||||
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)
|
||||
luaL_error(L, "unable to get ModuleFileName");
|
||||
else {
|
||||
|
@ -159,7 +159,7 @@ static void setprogdir (lua_State *L) {
|
|||
static void pusherror (lua_State *L) {
|
||||
int error = GetLastError();
|
||||
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))
|
||||
lua_pushstring(L, buffer);
|
||||
else
|
||||
|
@ -172,7 +172,7 @@ static void ll_unloadlib (void *lib) {
|
|||
|
||||
|
||||
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? */
|
||||
if (lib == NULL) pusherror(L);
|
||||
return lib;
|
||||
|
|
Loading…
Reference in New Issue