473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Writing a custom libc

where can I get the pieces needed to write a custom C library? I ask
because I'm working on a rather large set of libraries where the extra
stuff in glibc is a waste of space.

May 31 '06 #1
4 2245
Levi Campbell wrote:
where can I get the pieces needed to write a custom C library? I ask
because I'm working on a rather large set of libraries where the extra
stuff in glibc is a waste of space.

Eh? Not including stuff you don't use is the linker's job.

--
Ian Collins.
May 31 '06 #2
Ian Collins wrote:
Levi Campbell wrote:
where can I get the pieces needed to write a custom C library? I ask
because I'm working on a rather large set of libraries where the extra
stuff in glibc is a waste of space.


Eh? Not including stuff you don't use is the linker's job.


The linker isn't always up to the task. For example,
a program that never uses any of the <locale.h> functions
but uses <ctype.h> might drag in a whole bunch of the locale
machinery, because the <ctype.h> facilities are sensitive to
the locale changes the program will never perform. Also, the
use of shared libraries tends to make library inclusion an
all-or-nothing proposition -- although in this case, the amount
of space used in the entire system usually decreases even if
the amount "used" by a single program seems to be greater than
if it incorporated only the "necessary" functions.

If the O.P. has actually measured the amount of "extra
stuff" and found that it can't be tolerated (highly unlikely;
if he'd measured anything he'd probably have mentioned it),
there are a couple of possible strategies. First, he could
see whether his system supports "static linking," following the
model implicit in Ian Collins' post. If that's not enough, he
can get hold of the glibc source and start throwing things out
until he's got a smaller (maybe), less functional (surely), and
non-conforming (probably) library that works for his program
but for few others. And I bet it won't save him much, either.

--
Eric Sosman
es*****@acm-dot-org.invalid
May 31 '06 #3
Eric Sosman wrote:
Ian Collins wrote:
Levi Campbell wrote:
where can I get the pieces needed to write a custom C library? I ask
because I'm working on a rather large set of libraries where the extra
stuff in glibc is a waste of space.


Eh? Not including stuff you don't use is the linker's job.


The linker isn't always up to the task. For example,
a program that never uses any of the <locale.h> functions
but uses <ctype.h> might drag in a whole bunch of the locale
machinery, because the <ctype.h> facilities are sensitive to
the locale changes the program will never perform. Also, the
use of shared libraries tends to make library inclusion an
all-or-nothing proposition -- although in this case, the amount
of space used in the entire system usually decreases even if
the amount "used" by a single program seems to be greater than
if it incorporated only the "necessary" functions.

If the O.P. has actually measured the amount of "extra
stuff" and found that it can't be tolerated (highly unlikely;
if he'd measured anything he'd probably have mentioned it),
there are a couple of possible strategies. First, he could
see whether his system supports "static linking," following the
model implicit in Ian Collins' post. If that's not enough, he
can get hold of the glibc source and start throwing things out
until he's got a smaller (maybe), less functional (surely), and
non-conforming (probably) library that works for his program
but for few others. And I bet it won't save him much, either.

--
Eric Sosman
es*****@acm-dot-org.invalid


You *do* realize you've given me the answer don't you? All I have to do
is write a new locale that can handle braille and patch the aclocal.m4
and Makefile to a) skip the threading and use sockets. b) use the
braille-enabled locale as the default.

thanks!

May 31 '06 #4
Ico
Levi Campbell <le*********@gmail.com> wrote:
where can I get the pieces needed to write a custom C library? I ask
because I'm working on a rather large set of libraries where the extra
stuff in glibc is a waste of space.


Assuming you are running linux: other C libraries with a much smaller
footprint exist, take a look at uClibc.
--
:wq
^X^Cy^K^X^C^C^C^C
May 31 '06 #5

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

Similar topics

1
by: Google Mike | last post by:
Tell me if this can be done, and if I have a misconception here. I am writing an app that will be served up in an app farm, and therefore I need to move the session information to the client, not...
6
by: Affan Syed | last post by:
I am not able to figure out exactly what this macro is doing. Can one of the gurus around here decipher this? #define sei() __asm__ __volatile__ ("sei" ::) PS: It is from the avr-libc...
25
by: Roger | last post by:
I am writing non GUI software in C for use on Windows and Linux. while libc packages are generally compatible, I am ending up with a lot of conditional macros for OS and I/O related stuff such as...
0
by: David F. | last post by:
Getting this message so turned on /VERBOSE - part of the output is below (the only reference to searching of libc.lib). This is for a multi-threaded application and AFAIK all my libs are...
0
by: jason.pirok | last post by:
I've been reading other groups related to this error and I'm only getting more confused. I'm still quite new to MC++ and I could use a swift kick in the right direction. The application I'm...
20
by: int main(void) | last post by:
Hi all, What do you people think as the best libc implementation. I'm a newbie, browsing through the open source codes of various libc implementation. I want to what is the best libc...
1
by: usa777 | last post by:
There are pthread_create symbols in libphread.so, libthread.so and libc.so. The following symbols displayed with the nm command: Value Size Type Bind Other Shndx Name ...
12
by: Anna Smidt | last post by:
Hello again, I am trying to convert a VC6 project to VC9, and the linker tells me that it cannot open file 'LIBC.lib'. But I didn't find this lib referenced or added anywhere. I used the linker...
0
ashitpro
by: ashitpro | last post by:
Writing System Call Wrappers in User Space. Recently I saw a post in Linux/Unix section to know the user who deleted the file in linux. Currently there is nothing in linux which could achieve...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...

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.