libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] set handler->info.name for all modules, not just libtool modules


From: Kevin P. Fleming
Subject: [PATCH] set handler->info.name for all modules, not just libtool modules
Date: Wed, 15 Oct 2003 08:05:23 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20030925

As a followup to the discussion earlier this week, I'd like to suggest the 
patch below. This
causes ltdl to _always_ set handler->info.name to a canonicalized library name, 
instead of
only doing it for libtool-created modules. The only disadvantage that I can see 
to doing this
is that when lt_dlsym is called for a non-libtool module, a spurious lookup for
"modulename_LTX_symbol" will be done, when it wasn't before. I can't see how 
this would
cause an actual problem for anyone, though, since it's not likely they'd have 
symbols named
that way if they're not using libtool to create their libraries.

With this change, lt_dlsym()-ing a symbol from a preloaded library works 
properly on my system;
it searches for the symbol with the *_LTX_ prefix, which means I don't have to 
forcibly add
that prefix in my code.

--- ltdl.dist   Wed Oct 15 07:11:08 2003
+++ ltdl.c      Wed Oct 15 07:37:39 2003
@@ -3092,8 +3092,34 @@

   assert (base_name && *base_name);

-  /* Check whether we are opening a libtool module (.la extension).  */
   ext = strrchr (base_name, '.');
+
+  /* extract the module name from the file name */
+  name = LT_EMALLOC (char, ext - base_name + 1);
+  if (!name)
+    {
+      ++errors;
+      goto cleanup;
+    }
+
+  /* canonicalize the module name */
+  {
+    size_t i;
+    for (i = 0; i < ext - base_name; ++i)
+      {
+       if (isalnum ((int)(base_name[i])))
+         {
+           name[i] = base_name[i];
+         }
+       else
+         {
+           name[i] = '_';
+         }
+      }
+    name[ext - base_name] = LT_EOS_CHAR;
+  }
+
+  /* Check whether we are opening a libtool module (.la extension).  */
   if (ext && strcmp (ext, archive_ext) == 0)
     {
       /* this seems to be a libtool module */
@@ -3110,31 +3136,6 @@
         of libtool */
       int      installed = 1;

-      /* extract the module name from the file name */
-      name = LT_EMALLOC (char, ext - base_name + 1);
-      if (!name)
-       {
-         ++errors;
-         goto cleanup;
-       }
-
-      /* canonicalize the module name */
-      {
-        size_t i;
-        for (i = 0; i < ext - base_name; ++i)
-         {
-           if (isalnum ((int)(base_name[i])))
-             {
-               name[i] = base_name[i];
-             }
-           else
-             {
-               name[i] = '_';
-             }
-         }
-        name[ext - base_name] = LT_EOS_CHAR;
-      }
-
       /* Now try to open the .la file.  If there is no directory name
          component, try to find it first in user_search_path and then other
          prescribed paths.  Otherwise (or in any case if the module was not
        





reply via email to

[Prev in Thread] Current Thread [Next in Thread]