Skip to content

Commit

Permalink
use ANSI versions of DLL functions in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-ieru committed Jun 13, 2010
1 parent bd262d5 commit 9f48712
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions loadlib.c
Original file line number Diff line number Diff line change
@@ -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
**
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit 9f48712

Please sign in to comment.