aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib/dynload.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-02-26 18:44:36 +0000
committerWerner Koch <[email protected]>2010-02-26 18:44:36 +0000
commit2cf687cb3e2818ac3a6b51fea282a65f4395f580 (patch)
tree51376a0ff19c4aea990c42a895c3ef104881c240 /jnlib/dynload.h
parentSome minor changes and typo fixes. (diff)
downloadgnupg-2cf687cb3e2818ac3a6b51fea282a65f4395f580.tar.gz
gnupg-2cf687cb3e2818ac3a6b51fea282a65f4395f580.zip
First batch of changes to support W32CE.
Note that jnlib/w32-reg.c is not yet ready.
Diffstat (limited to 'jnlib/dynload.h')
-rw-r--r--jnlib/dynload.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/jnlib/dynload.h b/jnlib/dynload.h
index 54774650d..0c8a3bbaa 100644
--- a/jnlib/dynload.h
+++ b/jnlib/dynload.h
@@ -1,5 +1,5 @@
/* dynload.h - Wrapper functions for run-time dynamic loading
- * Copyright (C) 2003 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2010 Free Software Foundation, Inc.
*
* This file is part of JNLIB.
*
@@ -24,13 +24,21 @@
# include <dlfcn.h>
#else
# include <windows.h>
-
+# include "utf8conv.h"
+# include "mischelp.h"
# define RTLD_LAZY 0
static inline void *
-dlopen (const char * name, int flag)
+dlopen (const char *name, int flag)
{
- void * hd = LoadLibrary (name);
+ void *hd;
+#ifdef HAVE_W32CE_SYSTEM
+ wchar_t *wname = utf8_to_wchar (name);
+ hd = wname? LoadLibrary (wname) : NULL;
+ _jnlib_free (wname);
+#else
+ hd = LoadLibrary (name);
+#endif
(void)flag;
return hd;
}
@@ -40,7 +48,13 @@ dlsym (void *hd, const char *sym)
{
if (hd && sym)
{
- void * fnc = GetProcAddress (hd, sym);
+#ifdef HAVE_W32CE_SYSTEM
+ wchar_t *wsym = utf8_to_wchar (sym);
+ void *fnc = wsym? GetProcAddress (hd, wsym) : NULL;
+ _jnlib_free (wsym);
+#else
+ void *fnc = GetProcAddress (hd, sym);
+#endif
if (!fnc)
return NULL;
return fnc;
@@ -53,7 +67,7 @@ static inline const char *
dlerror (void)
{
static char buf[32];
- sprintf (buf, "ec=%lu", GetLastError ());
+ snprintf (buf, sizeof buf, "ec=%lu", GetLastError ());
return buf;
}