libtool-patches
[Top][All Lists]
Advanced

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

Re: MSVC: Preloading in ltdl doesn't heed libname_spec.


From: Ralf Wildenhues
Subject: Re: MSVC: Preloading in ltdl doesn't heed libname_spec.
Date: Tue, 6 Jul 2010 07:52:51 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

Hi Peter,

any chance you could post your patches inline?  Thanks.

* Peter Rosin wrote on Mon, Jul 05, 2010 at 02:45:28PM CEST:
> http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg00152.html

This is ok with nits below addressed, thanks.

>     Make preloading heed libname_spec.
>     
>     * libltdl/ltdl.c (libprefix): New static variable describing
>     the prefix of static archives.
>     (try_dlopen): Use libprefix.
>     * libltdl/m4/ltdl.m4 (_LTDL_SETUP): Export prefix of static
>     archives to config.h.

Please mention which test case is fixed on which system/compiler by this
patch (the ones you know for sure).

> --- a/libltdl/ltdl.c
> +++ b/libltdl/ltdl.c
> @@ -54,6 +54,10 @@ or obtained by writing to the Free Software Foundation, 
> Inc.,
>  #  define LT_LIBEXT "a"
>  #endif
>  
> +#if !defined(LT_LIBPREFIX)
> +#  define LT_LIBPREFIX "lib"
> +#endif
> +
>  /* This is the maximum symbol size that won't require malloc/free */
>  #undef       LT_SYMBOL_LENGTH
>  #define LT_SYMBOL_LENGTH     128
> @@ -72,6 +76,7 @@ or obtained by writing to the Free Software Foundation, 
> Inc.,
>  static       const char      objdir[]                = LT_OBJDIR;
>  static       const char      archive_ext[]           = LT_ARCHIVE_EXT;
>  static  const char   libext[]                = LT_LIBEXT;
> +static  const char   libprefix[]             = LT_LIBPREFIX;
>  #if defined(LT_MODULE_EXT)
>  static       const char      shlib_ext[]             = LT_MODULE_EXT;
>  #endif
> @@ -1272,8 +1277,8 @@ try_dlopen (lt_dlhandle *phandle, const char *filename, 
> const char *ext,
>  
>        if (vtable)
>       {
> -       /* name + "." + libext + NULL */
> -       archive_name = MALLOC (char, LT_STRLEN (name) + strlen (libext) + 2);
> +       /* libprefix + name + "." + libext + NULL */
> +       archive_name = MALLOC (char, strlen (libprefix) + LT_STRLEN (name) + 
> strlen (libext) + 2);
>         *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));
>  
>         if ((*phandle == NULL) || (archive_name == NULL))
> @@ -1285,7 +1290,14 @@ try_dlopen (lt_dlhandle *phandle, const char 
> *filename, const char *ext,
>  
>         /* Preloaded modules are always named according to their old
>            archive name.  */
> -       sprintf (archive_name, "%s.%s", name, libext);
> +       if (strncmp(name, "lib", 3) == 0)
> +         {
> +           sprintf (archive_name, "%s%s.%s", libprefix, name + 3, libext);
> +         }
> +       else
> +         {
> +           sprintf (archive_name, "%s.%s", name, libext);
> +         }
>  
>         if (tryall_dlopen (&newhandle, archive_name, advise, vtable) == 0)
>           {

> --- a/libltdl/m4/ltdl.m4
> +++ b/libltdl/m4/ltdl.m4
> @@ -410,6 +410,11 @@ AC_CHECK_FUNCS([strlcat strlcpy], [], 
> [AC_LIBOBJ([lt__strl])])
>  m4_pattern_allow([LT_LIBEXT])dnl
>  AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension])
>  
> +name=
> +lt_libprefix=`eval "\\$ECHO \"$libname_spec\""`

This is simpler, less buggy, and more efficiently written as
   eval "lt_libprefix=\"$libname_spec\""

> +m4_pattern_allow([LT_LIBPREFIX])dnl
> +AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix])
> +
>  name=ltdl
>  LTDLOPEN=`eval "\\$ECHO \"$libname_spec\""`

This, too.

>  AC_SUBST([LTDLOPEN])

Cheers,
Ralf



reply via email to

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