Add the possibility to have symbols loaded globally with DSO.
authorRichard Levitte <levitte@openssl.org>
Wed, 11 Jun 2003 22:42:28 +0000 (22:42 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 11 Jun 2003 22:42:28 +0000 (22:42 +0000)
CHANGES
crypto/dso/dso.h
crypto/dso/dso_dlfcn.c

diff --git a/CHANGES b/CHANGES
index 7c9c59c5c52c04a7650ee9c99551c281e363a420..84bba6b68f89cbe5e60611278ab668063d9b74e9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@
 
  Changes between 0.9.7c and 0.9.8  [xx XXX xxxx]
 
 
  Changes between 0.9.7c and 0.9.8  [xx XXX xxxx]
 
+  *) Add the possibility to load symbols globally with DSO.
+     [Götz Babin-Ebell <babin-ebell@trustcenter.de> via Richard Levitte]
+
   *) Add the functions ERR_set_mark() and ERR_pop_to_mark() for better
      control of the error stack.
      [Richard Levitte]
   *) Add the functions ERR_set_mark() and ERR_pop_to_mark() for better
      control of the error stack.
      [Richard Levitte]
index 9a1cdabf39a0ce8c342a0faded75c5e0d8f51c1d..fccf54f960cdc0a639c680167e7e60cab6cd6f67 100644 (file)
@@ -95,6 +95,13 @@ extern "C" {
  */
 #define DSO_FLAG_UPCASE_SYMBOL                 0x10
 
  */
 #define DSO_FLAG_UPCASE_SYMBOL                 0x10
 
+/* This flag loads the library with public symbols.
+ * Meaning: The exported symbols of this library are public
+ * to all libraries loaded after this library.
+ * At the moment only implemented in unix.
+ */
+#define DSO_FLAG_GLOBAL_SYMBOLS                        0x20
+
 
 typedef void (*DSO_FUNC_TYPE)(void);
 
 
 typedef void (*DSO_FUNC_TYPE)(void);
 
index de88b2fd16d033da6795271e10fe255de4ee6804..259aee83e7581d78e20ef6f9c8492d2a589370c4 100644 (file)
@@ -140,13 +140,19 @@ static int dlfcn_load(DSO *dso)
        void *ptr = NULL;
        /* See applicable comments in dso_dl.c */
        char *filename = DSO_convert_filename(dso, NULL);
        void *ptr = NULL;
        /* See applicable comments in dso_dl.c */
        char *filename = DSO_convert_filename(dso, NULL);
+       int flags = DLOPEN_FLAG;
 
        if(filename == NULL)
                {
                DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME);
                goto err;
                }
 
        if(filename == NULL)
                {
                DSOerr(DSO_F_DLFCN_LOAD,DSO_R_NO_FILENAME);
                goto err;
                }
-       ptr = dlopen(filename, DLOPEN_FLAG);
+
+#ifdef RTLD_GLOBAL
+       if (dso->flags & DSO_FLAG_GLOBAL_SYMBOLS)
+               flags |= RTLD_GLOBAL;
+#endif
+       ptr = dlopen(filename, flags);
        if(ptr == NULL)
                {
                DSOerr(DSO_F_DLFCN_LOAD,DSO_R_LOAD_FAILED);
        if(ptr == NULL)
                {
                DSOerr(DSO_F_DLFCN_LOAD,DSO_R_LOAD_FAILED);