don't name-mangle non-PLT DLLs

svn: r2776
This commit is contained in:
Matthew Flatt 2006-04-25 17:20:06 +00:00
parent 0cae745858
commit 1283d749a5
7 changed files with 22 additions and 25 deletions

View File

@ -61,7 +61,7 @@ typedef size_t (*iconv_proc_t)(iconv_t cd,
typedef iconv_t (*iconv_open_proc_t)(const char *tocode, const char *fromcode); typedef iconv_t (*iconv_open_proc_t)(const char *tocode, const char *fromcode);
typedef void (*iconv_close_proc_t)(iconv_t cd); typedef void (*iconv_close_proc_t)(iconv_t cd);
typedef char *(*locale_charset_proc_t)(); typedef char *(*locale_charset_proc_t)();
static errno_proc_t msvcrt_errno; static errno_proc_t iconv_errno;
static iconv_proc_t iconv; static iconv_proc_t iconv;
static iconv_open_proc_t iconv_open; static iconv_open_proc_t iconv_open;
static iconv_close_proc_t iconv_close; static iconv_close_proc_t iconv_close;
@ -74,19 +74,24 @@ static char *nl_langinfo(int which)
static int get_iconv_errno(void) static int get_iconv_errno(void)
{ {
int *a; int *a;
a = msvcrt_errno(); a = iconv_errno();
return *a; return *a;
} }
# undef HAVE_CODESET # undef HAVE_CODESET
# define HAVE_CODESET 1 # define HAVE_CODESET 1
# define CODESET 0 # define CODESET 0
# define ICONV_errno get_iconv_errno() # define ICONV_errno get_iconv_errno()
extern char *scheme_get_dll_path(char *s);
static int iconv_ready = 0; static int iconv_ready = 0;
static void init_iconv() static void init_iconv()
{ {
# ifdef MZ_NO_ICONV # ifdef MZ_NO_ICONV
# else # else
HMODULE m; HMODULE m;
m = LoadLibrary(scheme_get_dll_path("iconv.dll"));
if (!m)
m = LoadLibrary(scheme_get_dll_path("libiconv.dll"));
if (!m)
m = LoadLibrary("iconv.dll"); m = LoadLibrary("iconv.dll");
if (!m) if (!m)
m = LoadLibrary("libiconv.dll"); m = LoadLibrary("libiconv.dll");
@ -103,16 +108,22 @@ static void init_iconv()
} }
} }
if (iconv) { if (iconv) {
iconv_errno = (errno_proc_t)GetProcAddress(m, "_errno");
if (!iconv_errno) {
/* The iconv.dll distributed with PLT Scheme links to msvcrt.dll.
It's a slighly dangerous assumption that whaetever iconv we
found also uses msvcrt.dll. */
m = LoadLibrary("msvcrt.dll"); m = LoadLibrary("msvcrt.dll");
if (m) { if (m) {
msvcrt_errno = (errno_proc_t)GetProcAddress(m, "_errno"); iconv_errno = (errno_proc_t)GetProcAddress(m, "_errno");
if (!msvcrt_errno) { if (!iconv_errno) {
iconv = NULL; iconv = NULL;
iconv_open = NULL; iconv_open = NULL;
iconv_close = NULL; iconv_close = NULL;
} }
} }
} }
}
# endif # endif
iconv_ready = 1; iconv_ready = 1;
} }

View File

@ -2,16 +2,3 @@ This directory contains extra DLLs that are needed for running PLT
Scheme. The DLL files are moved into the PLT folder by Scheme. The DLL files are moved into the PLT folder by
plt/src/mzscheme/dynsrc/mkmzdyn.bat plt/src/mzscheme/dynsrc/mkmzdyn.bat
which is, in turn, called by the MSVC projects. which is, in turn, called by the MSVC projects.
----------------------------------------------------------------------
uniplt_xxxxxxx.dll
This DLL is really Microsoft's UnicoWS.dll. Microsoft allows
redistribution of this DLL, but discourages installing it into the
system folder. So, we rename it (and version-mangle the name) so that
it can be installed into the system folder without conflicts.
This DLL is only loaded by MzScheme/MrEd under Windows 95/98/Me. It's
actually not needed at all under Windows NT/2000/XP.
----------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,8 +14,7 @@ HMODULE LoadUnicowsProc(void)
{ {
char *s; char *s;
/* Versioning should replace the "xxxxxxx" */ s = scheme_get_dll_path("UnicoWS.dll");
s = scheme_get_dll_path("uniplt_xxxxxxx.dll");
return LoadLibrary(s); return LoadLibrary(s);
} }