From 66af2bdedf91fa4f71c3322fc564b4c29a561c08 Mon Sep 17 00:00:00 2001 From: erg Date: Tue, 7 Aug 2007 22:47:10 +0000 Subject: [PATCH] Further fixes to allow ltdl to work on Windows. --- lib/gvc/gvconfig.c | 4 +++- lib/gvc/gvplugin.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c index 2ee1b75d3..19c4ce030 100644 --- a/lib/gvc/gvconfig.c +++ b/lib/gvc/gvconfig.c @@ -273,7 +273,9 @@ char * gvconfig_libdir(void) /* this code has to be modified to read value from * registry or argg[0] -- +/lib etc method. FIX */ - libdir="C:/graphviz/local/lib"; + libdir=getenv("GRAPHVIZBIN"); + if (!libdir) + libdir="C:/graphviz/local/bin"; #else /* this only works on linux, other systems will get GVLIBDIR only */ libdir = GVLIBDIR; diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 6c34acdca..3b1d78e58 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -123,7 +123,11 @@ gvplugin_library_t *gvplugin_library_load(GVC_t *gvc, char *path) p = gmalloc(lenp); } +#ifdef WIN32 + if (path[1] == ':') { +#else if (path[0] == '/') { +#endif strcpy(p, path); } else { strcpy(p, libdir); @@ -137,7 +141,7 @@ gvplugin_library_t *gvplugin_library_load(GVC_t *gvc, char *path) } hndl = lt_dlopen (p); if (!hndl) { - agerr(AGWARN, (char*)lt_dlerror()); + agerr(AGWARN, "Could not load \"%s\" - %s\n", p, (char*)lt_dlerror()); return NULL; } if (gvc->common.verbose >= 2) @@ -145,12 +149,20 @@ gvplugin_library_t *gvplugin_library_load(GVC_t *gvc, char *path) s = strrchr(p, '/'); len = strlen(s); +#ifdef WIN32 + if (len < strlen("/gvplugin_x")) { +#else if (len < strlen("/libgvplugin_x")) { +#endif agerr (AGERR,"invalid plugin path \"%s\"\n", p); return NULL; } sym = gmalloc(len + strlen(suffix) + 1); +#ifdef WIN32 + strcpy(sym, s+1); /* strip leading "/" */ +#else strcpy(sym, s+4); /* strip leading "/lib" or "/cyg" */ +#endif #ifdef __CYGWIN__ s = strchr(sym, '-'); /* strip trailing "-1.dll" */ #else -- 2.40.0