Hello Philippe,

Apologies for the long delay.

* Philippe Barthelemy wrote on Sat, Jul 01, 2006 at 11:41:12PM CEST:
> 
> A pretty basic question I guess :

Not as basic as I had thought ... but let's see:

> trying to compile a program, one of the executable can not find a 
> function from a libtool-generated library.
> 
> How can I check the exported ( visible ) functions and symbols in a .la 
> file?

Well, for now there isn't a documented way to do this easily with
Libtool, but I think there should be.  So below is a script to achieve
it.  Please try it and report how it fares; it should be fairly portable
but I have not tested it much at all, and it does not work with
uninstalled program wrappers yet.

I'm not yet sure how a good inclusion of the functionality into libtool
proper would look like.  Similar stuff could be provided for stripping,
and maybe objdump... maybe a new --mode?  Thoughts?

Cheers,
Ralf
#! /bin/sh
# Copyright (C) 2006  Ralf Wildenhues <[EMAIL PROTECTED]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

usage ()
{
  echo "\
libtool-nm [OPTIONS-FOR-NM] LIBTOOL-OBJECT|LIBTOOL-LIBRARY...
libtool-nm [--help|--version]

Use NM on libtool (or non-libtool) object files or libraries."
  exit $?
}

version ()
{
  echo "libtool-nm 0.1"
  exit $?
}

: ${LIBTOOL=libtool}
eval `$LIBTOOL --config | grep '^NM='`
eval `$LIBTOOL --config | grep '^objdir='`

list=
for arg
do
  file=$arg
  case $arg in
  --help) usage ;;
  --version) version ;;
  -*) ;;
  *.la)
    dir=`dirname "$file"`
    test "$dir" = . && arg=./$file
    library_names= old_library= installed=no
    . "$arg" 2>/dev/null
    set x $library_names $old_library
    if test -z "$2"; then
      echo "could not parse libtool library $arg" >&2
      exit 1
    fi
    if test "$installed" = yes; then
      file=$dir/$2
    else
      file=$dir/$objdir/$2
    fi ;;
  *.lo)
    dir=`dirname "$file"`
    test "$dir" = . && arg=./$file
    pic_object= non_pic_object=
    . "$arg" 2>/dev/null
    if test "$pic_object" != none; then
      file=$dir/$pic_object
    elif test "$non_pic_object" != none; then
      file=$dir/$non_pic_object
    else
      echo "could not parse libtool object $arg" >&2
      exit 1
    fi ;;
  esac
  list="$list $file"
done

exec $NM $list
exit 1
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to