How to know the library name when I already know function name
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
In all seriousness, I don't know how you would try and use a function (assuming C) in C without knowing the library you are calling it from. If you don't include the library than you can't call the function.
Do you think you could explain a little more clearly what you are trying to do?
It is easy to know which .h file need to include into my source code which calling the local_bh_enable() function. But when I compile, the error occurs (cannot link the library). I need to know the name of library which contains local_bh_enable() to pass to the command line
gcc myproject -lXX
My question is XX = ?
(XX is the name of library which contains local_bh_enable())
Display the dynamic symbols rather than the normal symbols. This
is only meaningful for dynamic objects, such as certain types of
-- excerpt from man nm
# @(#) s1 Demonstrate nm extraction of symbols from shared libraries.
set -o nounset
echo " sh version: $BASH_VERSION"
echo " Looking at $LIB:"
nm $LIB 2>/dev/null | head -10
echo " Looking at $LIB:"
nm -D $LIB 2>/dev/null | head -10
sh version: 2.05b.0(1)-release
Looking at /usr/lib/libm.a:
00000000 T __kernel_standard
Looking at /lib/libm-2.3.2.so:
00000000 A GLIBC_2.0
00000000 A GLIBC_2.1
00000000 A GLIBC_2.2
00021538 D _LIB_VERSION
0000c380 T __clog10
00013090 T __clog10f
0001a7b0 T __clog10l
If I understand your comment regarding the inefficiency of following links, that seems to be an issue of the design of library layout, rather than nm. Please clarify if I have not understood correctly ... cheers, makyo