[uClibc] cc and libc linkage

Bennett Todd bet at rahul.net
Thu Feb 12 14:49:30 UTC 2004


I'll take a swing at this, even though it's more theoretical than
applied, I haven't gotten down in these particular trenches.

A language binding for a library --- Ok, let's narrow that down, a C
language binding (but this same line of thinking will apply to many
other languages) consists of two parts: there are callable routines,
in some kind of library that compiled objects can be linked to ---
libc.a, or libc.so, or whatever. And then there are the parts that
inform the compiler, at source code compile time, of the details of
the API.

Some details of the interface to libc are more or less nailed down
by various standards, but many more aren't; in particular, many
interfaces use more or less opaque objects. fopen(3) returns a
FILE *, which can be passed to fprintf(3) and then fclose(3). And
<stdio.h> not only declares the FILE * type, and the calling
interfaces of those routines, it also makes available some names,
stdin, stdout, and stderr, for some pre-created FILE * handles that
are available for use. It also defines scads of assorted numeric
constants for use as control values in various calls --- the SEEK_*
parameters, for instance.

cc knows how to find the "system" headers, it has /usr/include
hardwired in it for finding <path/to/file.h>. Depending on your
goals, there are various ways to deal with the novel situation that
glibc, uClibc, dietlibc, and presumably others create. uClibc's
toolchain filesystems are a really easy way to get cooking. dietlibc
stashes everything, headers and libs, in an out-of-the-way subdir
then provides a "diet" wrapper command that takes a gcc commandline
as its args, and invokes gcc suitably to use the installed dietlibc
headers and libs instead of whatever is in /usr/include and
/usr/lib.

-Bennett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20040212/f6f7b2b9/attachment-0002.pgp 


More information about the uClibc mailing list