[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: dlopen refocus



You might want to try this.


Sarathy
gsar@ActiveState.com
-----------------------------------8<-----------------------------------
--- perl/ext/DynaLoader/dl_dlopen.xs.~1~	Tue Jan  4 20:04:46 2000
+++ perl/ext/DynaLoader/dl_dlopen.xs	Tue Jan  4 20:04:46 2000
@@ -146,9 +146,20 @@
 dl_load_file(filename, flags=0)
     char *	filename
     int		flags
-    PREINIT:
+  PREINIT:
     int mode = RTLD_LAZY;
-    CODE:
+  CODE:
+{
+#if defined(DLOPEN_WONT_DO_RELATIVE_PATHS)
+    char pathbuf[PATH_MAX + 2];
+    if (*filename != '/' && strchr(filename, '/')) {
+	if (getcwd(pathbuf, PATH_MAX - strlen(filename))) {
+	    strcat(pathbuf, "/");
+	    strcat(pathbuf, filename);
+	    filename = pathbuf;
+	}
+    }
+#endif
 #ifdef RTLD_NOW
     if (dl_nonlazy)
 	mode = RTLD_NOW;
@@ -167,7 +178,7 @@
 	SaveError(aTHX_ "%s",dlerror()) ;
     else
 	sv_setiv( ST(0), PTR2IV(RETVAL));
-
+}
 
 void *
 dl_find_symbol(libhandle, symbolname)
--- /dev/null	Wed Mar  3 09:20:11 1999
+++ perl/ext/DynaLoader/hints/openbsd.pl	Tue Jan  4 19:17:31 2000
@@ -0,0 +1,3 @@
+# XXX Configure test needed?
+# Some OpenBSDs seem to have a dlopen() that won't accept relative paths
+$self->{CCFLAGS} = $Config{ccflags} . ' -DDLOPEN_WONT_DO_RELATIVE_PATHS';
End of Patch.


Follow-Ups from:
Tom Christiansen <tchrist@jhereg.perl.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]