forked from enlightenment/efl
Evil: add RTLD_DEFAULT support in dlsym() on Windows CE
SVN revision: 63847
This commit is contained in:
parent
3e2c4c377e
commit
98b3d37f90
|
@ -6,6 +6,11 @@
|
|||
add inet_ntop() function. Implementation from c-ares library.
|
||||
See AUTHORS.
|
||||
|
||||
* configure.ac:
|
||||
* src/lib/dlfcn/dlfcn.c:
|
||||
* src/lib/dlfcn/Makefile.am:
|
||||
add RTLD_DEFAULT support in dlsym() on Windows CE
|
||||
|
||||
2011-09-14 Vincent Torri <doursse at users dot sf dot net>
|
||||
|
||||
* src/lib/dlfcn/dlfcn.c:
|
||||
|
|
|
@ -99,21 +99,25 @@ AC_C___ATTRIBUTE__
|
|||
win32_cppflags="-DEFL_EVIL_BUILD"
|
||||
win32_cflags="-Wall -Wextra -Wshadow -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
|
||||
win32_cxxflags=""
|
||||
win32_libs=""
|
||||
have_wince="no"
|
||||
case "$host_os" in
|
||||
mingw32ce*)
|
||||
have_wince="yes"
|
||||
win32_cppflags="${win32_cppflags} -D_WIN32_WCE=0x0420"
|
||||
win32_libs="-ltoolhelp"
|
||||
;;
|
||||
*)
|
||||
have_wince="no"
|
||||
win32_cxxflags="-fno-rtti -fno-exceptions"
|
||||
win32_cppflags="${win32_cppflags} -D_WIN32_WINNT=0x0501 -DSECURITY_WIN32"
|
||||
win32_libs="-lpsapi"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(win32_cppflags)
|
||||
AC_SUBST(win32_cflags)
|
||||
AC_SUBST(win32_cxxflags)
|
||||
AC_SUBST([win32_cppflags])
|
||||
AC_SUBST([win32_cflags])
|
||||
AC_SUBST([win32_cxxflags])
|
||||
AC_SUBST([win32_libs])
|
||||
|
||||
AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes")
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ libdl_la_SOURCES = dlfcn.c
|
|||
|
||||
libdl_la_CPPFLAGS = @win32_cppflags@ -DEFL_EVIL_DLFCN_BUILD -DPSAPI_VERSION=1
|
||||
libdl_la_CFLAGS = @win32_cflags@
|
||||
libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la $(EFL_MPATROL_LIBS) -lpsapi
|
||||
libdl_la_LIBADD = $(top_builddir)/src/lib/libevil.la $(EFL_MPATROL_LIBS) @win32_libs@
|
||||
libdl_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@
|
||||
|
|
|
@ -9,7 +9,11 @@
|
|||
#endif /* __MINGW32CE__ || _MSC_VER */
|
||||
|
||||
#include <windows.h>
|
||||
#include <psapi.h> /* EnumProcessModules(Ex) */
|
||||
#ifdef _WIN32_WCE
|
||||
# include <tlhelp32.h> /* CreateToolhelp32Snapshot */
|
||||
#else
|
||||
# include <psapi.h> /* EnumProcessModules(Ex) */
|
||||
#endif
|
||||
|
||||
#include "../Evil.h"
|
||||
|
||||
|
@ -131,6 +135,26 @@ dlsym(void *handle, const char *symbol)
|
|||
|
||||
if (handle == RTLD_DEFAULT)
|
||||
{
|
||||
#ifdef _WIN32_WCE
|
||||
HANDLE snapshot;
|
||||
MODULEENTRY32 module;
|
||||
|
||||
snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS |
|
||||
TH32CS_SNAPMODULE |
|
||||
TH32CS_GETALLMODS,
|
||||
0);
|
||||
if (!snapshot)
|
||||
return NULL;
|
||||
|
||||
module.dwSize = sizeof(module);
|
||||
if (Module32First(snapshot, &module))
|
||||
do {
|
||||
fp = GetProcAddress(module.hModule, new_symbol);
|
||||
if (fp) break;
|
||||
} while (Module32Next(snapshot, &module));
|
||||
|
||||
CloseToolhelp32Snapshot(snapshot);
|
||||
#else
|
||||
HMODULE modules[1024];
|
||||
DWORD needed;
|
||||
DWORD i;
|
||||
|
@ -145,6 +169,7 @@ dlsym(void *handle, const char *symbol)
|
|||
fp = GetProcAddress(modules[i], new_symbol);
|
||||
if (fp) break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
fp = GetProcAddress(handle, new_symbol);
|
||||
|
|
Loading…
Reference in New Issue