473,788 Members | 2,726 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 3286
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
1698
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
2246
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
3390
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
2220
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
8826
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
3582
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
2395
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
2400
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
1400
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
10366
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
10175
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...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.