Curie Documentation

7

Introduction

This is libcurie, a small, minimalistic C library. It includes the bare minimum in functionality to get some use out of C, and some high-level concepts, such as a parser for s-expressions, trees and graphs. The reason for writing this C library is twofold. One reason is that if you try to write portable C code, you'll soon find that neither sticking to ANSI C nor POSIX C is portable enough to actually work, even on the more common operating systems. The other reason is that usually the main C library is quite large, and the functionality needed from it is quite small.

Portable, you say?

As most C programmers are aware of, POSIX is a nice standard... but it's not implemented consistently. A lot of operating systems claim POSIX compliance, but mysteriously you still need to work around bugs or differences in implementations left and right. Or sometimes the interface of your choice is implemented in all the OSs you care for, but the implementation plain sucks on one of them.

This whole situation sucks... so this library is intended to help with that. It tries to do this by trying to come up with a new, fresh, consistent API that should be implementable across all operating systems; even tricky ones like DOS. For this reason, the build system is unusually complex, and it is able to use different source files based on a wide number of characteristics of the target architecture, such as operating system, cpu architecture and the compiler toolchain that is used.

Actually this C library's interface should even be portable to freestanding environments.

We've had small libcs, haven't we?

We sure have seen a lot of small libcs... but there is only so small that you can get if you try to implement POSIX, or ANSI/ISO C. Luckily, we don't give a rat's arse about POSIX compliance. And the only C standards we dig are the language/syntax parts of the recent C standards, not the library part. Since it's perfectly legitimate to use C in freestanding environments, this shouldn't even violate the C standard itself.

To give some actual numbers of just how small curie applications can get, it might be fun to compile curie and its test suite on linux/amd64 or linux/ppc and to then examine the filesizes for libcurie.a and the test suite. Hint: the largest statically linked(!) binary in the test suite is 23 kilobytes on linux/amd64. Unfortunately the smallest is a rough 6.4 kilobytes on that architecture, mostly due to overly complex argv/environment handling there.


Generated on Wed Jan 7 02:10:44 2009 for Curie by  doxygen 1.5.4