473,854 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Way to view public function names in a library

Hi,

I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?

Thanks.
Oct 9 '08 #1
16 3296
Xiaoxiao <xi**********@l ive.comwrites:
I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?
There is no portable way to do that.

Your best bet is to read the documentation that (presumably)
accompanies the library. Just knowing the names of the functions
doesn't give you enough information.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 9 '08 #2
Xiaoxiao <xi**********@l ive.comwrites:
Hi,

I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?
This is technically off-topic, since it's not about the C language
itself but about whatever compiler and related tools you are using (you
didn't say what they are). You should probably look for another group
that is more specifically dedicated to your system and/or compiler.

However, on many systems the command that does this is called 'nm'.
Oct 9 '08 #3
On 9 Oct, 14:08, Keith Thompson <ks...@mib.orgw rote:
Xiaoxiao <xiaoxiaoy...@l ive.comwrites:
I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?

There is no portable way to do that.

Your best bet is to read the documentation that (presumably)
accompanies the library. *Just knowing the names of the functions
doesn't give you enough information.

--
Keith Thompson (The_Other_Keit h) ks...@mib.org *<http://www.ghoti.net/~kst>
Nokia
"We must do something. *This is something. *Therefore, we must do this."
* * -- Antony Jay and Jonathan Lynn, "Yes Minister"
Thanks Keith. My question should be how to know the function prototype
in the shared library. It seems from your answer that there is no way
to do it except getting the document, is that right?
Oct 9 '08 #4
On 9 Oct, 14:17, Nate Eldredge <n...@vulcan.la nwrote:
Xiaoxiao <xiaoxiaoy...@l ive.comwrites:
Hi,
I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?

This is technically off-topic, since it's not about the C language
itself but about whatever compiler and related tools you are using (you
didn't say what they are). *You should probably look for another group
that is more specifically dedicated to your system and/or compiler.

However, on many systems the command that does this is called 'nm'.
Thanks Nate. I didn't know where to ask but because I will call it
from a C function if I can, so I posted the question here. I am going
to use gcc compiler in Linux to compile my C program. I will check
'nm' to see what does it do.
Oct 9 '08 #5
Xiaoxiao <xi**********@l ive.comwrites:
On 9 Oct, 14:08, Keith Thompson <ks...@mib.orgw rote:
>Xiaoxiao <xiaoxiaoy...@l ive.comwrites:
I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?

There is no portable way to do that.

Your best bet is to read the documentation that (presumably)
accompanies the library. *Just knowing the names of the functions
doesn't give you enough information.

Thanks Keith. My question should be how to know the function prototype
in the shared library. It seems from your answer that there is no way
to do it except getting the document, is that right?
That's *probably* right. The format of a shared library, and even
what kind of information is stored in it, is beyond the scope of the C
langauge standard. Typically, though, I think all you could get from
a library is the name and entry point for each function (and the code
that implements each function). Prototypes are generally available in
header files. And if the header file is inconsistent with the
library, you're out of luck.

But even knowing the prototype for each function, though it might tell
you how to write a legal call to the function, isn't going to tell you
how to use it properly. An example from the standard library: knowing
that printf is declared as:

int printf(const char * restrict format, ...);

doesn't tell you what the format string should look like; only the
documentation can tell you that.

If you have a library and you want to call functions in that library,
reading the documentation seems like the obvious answer. The fact
that you're asking for another way to get information about the
functions in a library implies that you have another requirement that
you haven't told us about. If you'll tell us what you're really
trying to do, we may be able to help (or at least offer advice on
where you can find information relevant to your system).

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 9 '08 #6
Xiaoxiao wrote, On 09/10/08 18:50:
Hi,

I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?
The best method is to read the documentation. The second best method is
to read the header files provided with the library. If no documentation
or header files are provided then the next best method is to get them,
followed by using a different library.
--
Flash Gordon
If spamming me sent it to sm**@spam.cause way.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Oct 9 '08 #7
On 9 Oct, 14:38, Keith Thompson <ks...@mib.orgw rote:
Xiaoxiao <xiaoxiaoy...@l ive.comwrites:
On 9 Oct, 14:08, Keith Thompson <ks...@mib.orgw rote:
Xiaoxiao <xiaoxiaoy...@l ive.comwrites:
I got a C library, is there a way to view the public function names in
this library so that I can use in my C program?
There is no portable way to do that.
Your best bet is to read the documentation that (presumably)
accompanies the library. *Just knowing the names of the functions
doesn't give you enough information.
Thanks Keith. My question should be how to know the function prototype
in the shared library. It seems from your answer that there is no way
to do it except getting the document, is that right?

That's *probably* right. *The format of a shared library, and even
what kind of information is stored in it, is beyond the scope of the C
langauge standard. *Typically, though, I think all you could get from
a library is the name and entry point for each function (and the code
that implements each function). *Prototypes are generally available in
header files. *And if the header file is inconsistent with the
library, you're out of luck.

But even knowing the prototype for each function, though it might tell
you how to write a legal call to the function, isn't going to tell you
how to use it properly. *An example from the standard library: knowing
that printf is declared as:

* * int printf(const char * restrict format, ...);

doesn't tell you what the format string should look like; only the
documentation can tell you that.

If you have a library and you want to call functions in that library,
reading the documentation seems like the obvious answer. *The fact
that you're asking for another way to get information about the
functions in a library implies that you have another requirement that
you haven't told us about. *If you'll tell us what you're really
trying to do, we may be able to help (or at least offer advice on
where you can find information relevant to your system).

--
Keith Thompson (The_Other_Keit h) ks...@mib.org *<http://www.ghoti.net/~kst>
Nokia
"We must do something. *This is something. *Therefore, we must do this."
* * -- Antony Jay and Jonathan Lynn, "Yes Minister"
Thanks a lot for the help, Keith.
The fact that you're asking for another way to get information about the
functions in a library implies that you have another requirement that
you haven't told us about.
That's true. I got some C source code and shared library from
somewhere and studying it, and will modify it later, and I don't have
the document. I saw somewhere in the original C code that calls the
library functions that I don't know the function prototypes, so that's
why I was asking. Now after reading your post, I also see that there
are header files on the library there, then I can get the function
prototypes from the header files, as you have suggested. But there are
so many of them, and also as you said, even from the function
prototypes I will still need the document to use the functions
correctly.

I have one more question related to this: in generally, does every
shared memory go along with a header file or not? I mean, if I will
create a shared library for someone, do I also need to provide the
header file to him or not? I checked on the internet on the tutorials
of shared libary on Linux, and knew that there were static and dynamic
libraries, but all of them didn't mention whether header files are
needed to provide to others along with the produced libary. Or the
header file is just used for indicting the function prototypes in the
libary and doesn't really need for the application which calls the
library?

please forgive my entry level question.

Thank you so much for your patience and help again.
Oct 9 '08 #8
Xiaoxiao <xi**********@l ive.comwrites:
I have one more question related to this: in generally, does every
shared memory go along with a header file or not? I mean, if I will
create a shared library for someone, do I also need to provide the
header file to him or not?
Generally, he will need the header file if he wants to compile a program
that uses the library. If you give him a program that's already
compiled, together with the shared library, the header file is not needed.
Oct 9 '08 #9
On 9 Oct, 15:20, Nate Eldredge <n...@vulcan.la nwrote:
Xiaoxiao <xiaoxiaoy...@l ive.comwrites:
I have one more question related to this: in generally, does every
shared memory go along with a header file or not? I mean, if I will
create a shared library for someone, do I also need to provide the
header file to him or not?

Generally, he will need the header file if he wants to compile a program
that uses the library. *If you give him a program that's already
compiled, together with the shared library, the header file is not needed..
Thanks a lot for the clarification, Nate. Now I understand them much
better.
Oct 9 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1700
by: Booted Cat | last post by:
I've seen lots of discussions on the proposed inclusion of "function call with named arguments" to C/C++ on these newsgroups. My proposal is slightly different in that: * No ANSI approval is needed * No conflicts with existing language features such as function overloading * No need to modify the language spec or the compiler * No need to modify your source code
8
2250
by: Alvo von Cossel I | last post by:
hey everybody, I have written a great browser but it is missing a feature (quite a lot actually, but forget about them for now). that feature just so happens to be the View > Source function. for those of you who don't what i mean, it is when you click a button in the view menu that says Page source (in Netscape) and source (in Internet Explorer). if you click it, notepad opens. in that window is the html for the page. anyway, does...
2
3395
by: Senapathy | last post by:
VC++ .NET 2003 Standard Edition Win XP, SP2 Hi, I have a code that builds under VC6.0, but fails to link in VC7.1. The offending code is as follows: _AFX_RICHEDIT_STATE* const pEditState = _afxRichEditState;
12
2225
by: Raed Sawalha | last post by:
I have the following table which i can not switcha to design view error message said Could not open in Design view. Quote values differently inside a '<% ...."value"... %>' block. and the line which make the error is anchor but i cannot make it work. <TABLE id="tblDocList" dir="<%#strLangDir%>" style="DISPLAY:inline"
10
8841
by: Zack Sessions | last post by:
Has anyone tried to create a SQL7 view using the CREATE VIEW command and ADO.NET? If so, is there a trick in trapping a SQL error when trying to create the view? I have a VB.NET app that, amoung other things, can create views based on existing tables and a table of column name equivalents. If I accidently introduce a column name equivalent that is the same as another column, I end up with a CREATE VIEW SQL statement that is in error, if...
1
3585
by: Director - Minvent | last post by:
Hi, I am trying to work out the easiest way to add some things to a treeview. I have got a list of the priviliged names for each of the computers e.g. LDAP://DomainName/CN=ComputerName,OU=OrgUnit1,OU=OrgUnit2, DC=DCRecord1,DC=DCRecord2 I am iterating through a list of these names to split them into strings for
0
2401
by: weiwei | last post by:
Hi; I am having trouble to get variable from grid view. here is my scenario. I want to delete a row in database from web page, in additon, I also want to delete that user's directory in c:drive. so far, I can only finished the first part which is to delete the row from database, Please see below code where I want to get variable in order to delete the directory. Thanks in advance <%@ Page Language="VB" Debug="true" %> <script...
0
2407
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
0
1407
by: Christian | last post by:
Hi all, i already posted this in dotnet.vb.controls but i need some help, so i cant wait... I have written a web control library and have some problems with it. The Library contains only two Controls: a menu bar and a menu item class which can have sub items (from the same class and type).
0
9899
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9750
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10672
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10740
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5738
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4149
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.