How to make a C library

Suposse you want to create a library called ‘libhello’ that provides an ‘hello’ function to include in your program ‘main.c’.

Start by writing ‘hello.c’, e.g.:

void hello ();

int
main (int argc, char *argv[])
{
  hello ();
}

And the ‘main.c’,e.g.:

#include

void
hello ()
{
  printf ("Hello!n");
}

Compile ‘hello.c’ into an object with the ‘-c’ option to ‘gcc’:

$ gcc -c hello.c

Create the library using ar(1) e ranlib(1):

$ ar cru libhello.a hello.o
$ ranlib libhello.a

And finally compile your program using the new library you’ve created:

$ gcc -o hello main.c libhello.a
$ ./hello
Hello

References:

  • The Goat Book - Freely available book describing how to use GNU Autoconf, Automake, and Libtool.
  • The ar(1) e ranlib(1) manpages.

YouOS Web Operating System

Via Jeremy Zawodny Blog - The guys at YouOS are pulling up a web operating-system. It’s still wayyyy alpha, as they say, but the about page is already funny :).

More seriously, I recommend everyone trying it. It already has many applications like chat, mail, browser (browser inside browser!), etc.. but what really made my eyes came out was the app IDE (web-based they have). Really cool, guys, congratulations. Things like that make Web 2.0 mean something.

Trying out Basecamp

After listening to the Web 2.0 episode 9 podcast, I went over to Basecamp, a web-based application to manage collaborative projects, and decided to give it a try.

My review is: It’s nice, clean and simple. No feature overflow, just what the casual user will need. Recommended.

Just as the podcast tell us, the history behind Basecamp is really interesting. David Heinemeier Hansson and Jason Fried started a web design firm called 37signals that was focused on clean, fast and usable designs. David Hansson later started worked on Basecamp that later became the foundation for Ruby on Rails, the well-known open source web application framework. They soon became a product company.

As Jason says in this O’Reilly interview:

Jason: We built Basecamp because we needed it. I’m a big believer in investing in what you know and what you need. We invested our time, energy, and focus into building a product that we knew we needed to run our own business. When you build what you know, and when you use what you build, you’ve got a head start on delivering a breakout product.

Good thinking, right?

“Basecamp’s success as a bootstrapped web-based application has made it a favorite of web designers and also a model for would-be entrepreneurs.”