summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-04-29 19:26:06 +0300
committerEli Zaretskii <eliz@gnu.org>2013-04-29 19:26:06 +0300
commit19a69bafc0913f13e334b5f56d95c693fab29023 (patch)
treeb3f1d061b1a72d5f7e74a60831d85362f41fafe1 /load.c
parent9a7fe22b197770271a2235062fe52cb1c71a3d9e (diff)
downloadgunmake-19a69bafc0913f13e334b5f56d95c693fab29023.tar.gz
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.
Diffstat (limited to 'load.c')
-rw-r--r--load.c20
1 files changed, 19 insertions, 1 deletions
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