From 19a69bafc0913f13e334b5f56d95c693fab29023 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 29 Apr 2013 19:26:06 +0300 Subject: Support dynamic object loading on MS-Windows. w32/include/dlfcn.h: New file. w32/compat/posixfcn.c: Include dlfcn.h. (dlopen, dlerror, dlsym) [MAKE_LOAD]: New functions, in support of dynamic loading. config.h.W32.template (MAKE_LOAD): Define. load.c (load_object) [HAVE_DOS_PATHS]: Support backslashes and drive letters in file names of dynamic objects. --- load.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'load.c') diff --git a/load.c b/load.c index 95529c2..9a83829 100644 --- a/load.c +++ b/load.c @@ -49,7 +49,11 @@ load_object (const gmk_floc *flocp, int noerror, void *dlp = NULL; /* If the path has no "/", try the current directory first. */ - if (! strchr (ldname, '/')) + if (! strchr (ldname, '/') +#ifdef HAVE_DOS_PATHS + && ! strchr (ldname, '\\') +#endif + ) dlp = dlopen (concat (2, "./", ldname), RTLD_LAZY|RTLD_GLOBAL); /* If we haven't opened it yet, try the default search path. */ @@ -134,6 +138,20 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror) char *p = new; fp = strrchr (*ldname, '/'); +#ifdef HAVE_DOS_PATHS + if (fp) + { + const char *fp2 = strchr (fp, '\\'); + + if (fp2 > fp) + fp = fp2; + } + else + fp = strrchr (*ldname, '\\'); + /* The (improbable) case of d:foo. */ + if (fp && *fp && fp[1] == ':') + fp++; +#endif if (!fp) fp = *ldname; else -- cgit v1.2.3