changeset 880:beddd25fe24a

[xemacs-hg @ 2002-06-24 22:00:17 by youngs] 2002-06-17 Jerry James <james@xemacs.org> * emodules.texi (Loading other Modules): Describe why we do not use RTLD_GLOBAL. 2002-06-17 Jerry James <james@xemacs.org> * sysdll.c: Remove RTLD_GLOBAL initialization. * sysdll.c (dll_open): Do not use RTLD_GLOBAL.
author youngs
date Mon, 24 Jun 2002 22:00:25 +0000
parents f809bc97829a
children dfee0026a079
files man/ChangeLog man/emodules.texi src/ChangeLog src/sysdll.c
diffstat 4 files changed, 25 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/man/ChangeLog	Mon Jun 24 10:01:22 2002 +0000
+++ b/man/ChangeLog	Mon Jun 24 22:00:25 2002 +0000
@@ -1,3 +1,8 @@
+2002-06-17  Jerry James  <james@xemacs.org>
+
+	* emodules.texi (Loading other Modules): Describe why we do not
+	use RTLD_GLOBAL.
+
 2002-06-20  Adrian Aichner  <adrian@xemacs.org>
 
 	* xemacs/mule.texi (Language Environments): Typo fix suggested by
--- a/man/emodules.texi	Mon Jun 24 10:01:22 2002 +0000
+++ b/man/emodules.texi	Mon Jun 24 22:00:25 2002 +0000
@@ -483,6 +483,20 @@
 then their parents will also fail to load.  This does not include
 previous successful calls to @code{emodules_load} at the top level.
 
+@strong{Warning:} Modules are @emph{not} loaded with the
+@code{RTLD_GLOBAL} flag.  The practical upshot is that individual
+modules do not have access to each other's C symbols.  One module cannot
+make a C function call to a function defined in another module, nor can
+it read or set a C variable in another module.  All interaction between
+modules must, therefore, take place at the Lisp level.  This is by
+design.  Other projects have attempted to use @code{RTLD_GLOBAL}, only
+to find that spurious symbol name clashes were the result.  Helper
+functions often have simple names, increasing the probability of such a
+clash.  If you really need to share symbols between modules, create a
+shared library containing those symbols, and link your modules with
+that library.  Otherwise, interactions between modules must take place
+via Lisp function calls and Lisp variables accesses.
+
 @node Using ellcc, Defining Functions, Anatomy of a Module, Top
 @chapter Using @code{ellcc}
 @cindex @code{ellcc}
--- a/src/ChangeLog	Mon Jun 24 10:01:22 2002 +0000
+++ b/src/ChangeLog	Mon Jun 24 22:00:25 2002 +0000
@@ -1,3 +1,8 @@
+2002-06-17  Jerry James  <james@xemacs.org>
+
+	* sysdll.c: Remove RTLD_GLOBAL initialization.
+	* sysdll.c (dll_open): Do not use RTLD_GLOBAL.
+
 2002-06-24  Mike Sperber  <mike@xemacs.org>
 
 	* search.c (skip_chars): Fix a crash if NILP(lim).
--- a/src/sysdll.c	Mon Jun 24 10:01:22 2002 +0000
+++ b/src/sysdll.c	Mon Jun 24 22:00:25 2002 +0000
@@ -38,10 +38,6 @@
 # define RTLD_LAZY 1
 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */
 
-#ifndef RTLD_GLOBAL
-# define RTLD_GLOBAL 0
-#endif
-
 #ifndef RTLD_NOW
 # define RTLD_NOW 2
 #endif
@@ -55,7 +51,7 @@
 dll_handle
 dll_open (const char *fname)
 {
-  return (dll_handle) dlopen (fname, RTLD_NOW | RTLD_GLOBAL);
+  return (dll_handle) dlopen (fname, RTLD_NOW);
 }
 
 int