LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2004, 08:08 AM   #1
praj_linux
LQ Newbie
 
Registered: Nov 2003
Posts: 7

Rep: Reputation: 0
Seeking advice for size optimiztion


Hi all,
I am having a library named toolkit.a.
Its contains some exported functions.

I am using only one function from that library, which must be very small in size.
e.g. tk_strlen.

Problem is that my execuable size increases a lot.
Though I am using only one function from that library, I think my executable gets
bundled with all the functions.

How should I notiify the linker to ignore all the unused functions from the final build?

Is it posiible?

Praj.
 
Old 10-11-2004, 08:35 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Make toolkit a shared library instead of a static one. When you compile/link the library use --shared and call it toolkit.so.
 
Old 10-11-2004, 11:12 AM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
Of course, if your executable is likely to be the only one on the system which uses this shared library, the decreased size is an illusion : )
 
Old 10-11-2004, 04:30 PM   #4
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Did you write toolkit.c yourself?
If so (or even when not) you could try to just take out (copy) the code into your program (if the license allows, and you give credits where due).

If you did not write toolkit.c yourself then realize that though you only use one function, that function may use a lot of other functions in the same library...
 
Old 10-11-2004, 04:32 PM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
As a side-note, just or fun, see this on how to write tiny programs for Linux:

http://www.ubergeek.org/~breadbox/so...tiny/home.html
 
Old 10-11-2004, 11:02 PM   #6
praj_linux
LQ Newbie
 
Registered: Nov 2003
Posts: 7

Original Poster
Rep: Reputation: 0
Back to square one,
This library is a part of our project, and writen by us.
Problem was that our project contains a set of .so files.
We separated a common set of function from all the libraries,
and maintained it in toolkit.a.
Our project specification does not want a introduction of new .so file.
But using toolkit.a resulted in increased size of the libraries.
There must be some way/option to avoid bundling of non used function
in a final build.
Praj.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
seeking advice regarding Slackware adityavpratap Slackware 25 10-20-2005 11:47 AM
Seeking advice on HP printer selection satimis Fedora 0 02-22-2005 06:52 AM
Seeking advice on bash script satimis Programming 6 10-11-2004 11:01 AM
Seeking advice on script satimis Programming 1 10-05-2004 03:02 PM
Seeking Diagnosis Advice... verbal Linux - Hardware 2 09-12-2003 06:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration