One of the black magic arts is using Autotools and despite having copious amounts of documentation on the Internet- much of it is confusing! With this tutorial, I hope to reduce some of the complexity when creating a portable project using autotools; especially if you want to maintain it across several systems.
So the next real question is: what does autotools do for me, and what tasks do the following applications perform - autotools, libtool, autoconf, aclocal, automake and autoreconf? Fortunately, you don't need to know them all. :)
A quick summary of Autotools is that it is synonymous for GNU Build System. According to Wikipedia: "Autotools is a suite of programming tools designed to assist in making source code packages portable to many Unix-like systems." In other words, it helps simplify finding resources, prerequisite libraries, compilers and determining application configuration over several platforms or architectures (ex. X64_X86 vs. PPC). To be honest if you have a small project that is maybe less than 10-20 C files/headers or without any system/architecture specific requirements - stick to a basic Makefile in my opinion. However, if your maintaining something that will be distributed as a package - autotools is a pretty nice tool to have in your arsenal (and how many programmers know it?).
There are alot of tools here, but my goal is to keep this tutorial simple and to get you up and running without pulling your hair out:
Getting The Tutorial Pre-Requisites
Make sure you have the following installed on your system and extract the following example application.
sudo apt-get install binutils gcc autoconf make wget
wget <a href="http://www.pacificsimplicity.ca/sites/default/files/uploads/myApp.tar.gz
tar">http://www.pacificsimplicity.ca/sites/default/files/uploads/myApp.tar.gz...</a> -xzvf myApp.tar.gz
If you want examine the directories, but the general idea is that myApp looks like this:
From time to time at work we have used simclist, but unfortunately not as a shared object to reduce space. Enjoy!
To install it
wget <a href="http://www.pacificsimplicity.ca/sites/default/files/uploads/libsimclist-1.6.tar.gz
One of the most potentially confusing, but powerful tools in the C programming language is the amount of control and flexibility a developer has over memory using pointers. Here are a few things that I think every aspiring dabbler or beginner should know about pointers and memory at least at a layman's level.
I don't aim for this article to be 100% exhaustive, but to provide a quick reference or supplementary material for those learning pointers in C.
One of the best libraries I've stumbled across for libraries (minus glib) is Libconfig. It provides a nice way to read in, manage and edit configuration files in a simple unified way - my favorite feature of all is that my config files will look consistent! Its fairly well documented, but actual step through tutorials and explanations need a bit of work. Here are two example functions that should help you out:
One of the things any aspiring security professional or network admin should know is - what is exactly a socket and what do they do?. This is tutorial is a different approach that I have been toying with on how to best explain to beginning IT or security students who are just beginning, but have no experience using "low-level" languages like C. One of my esteemed professor's once said: "God intended us to program in C" and I believe that today's programmers should begin with a language which will teach them responsibility.
One of the things that bothers me about the oh so glorious Opensource is the lack of updated examples. Sure there is the "you-can-read-the-code" yourself attitude, which I find has a repugnant and arrogant odor to it... or the smash your head into the keyboard attitude until you figure it out. Thankfully, I did the smashing and realized that the ULOG and NFLOG examples in the libnetfilter_log code are incorrect.
Awhile back I had to use libevent for a high-performance application I was writing, and several times before that I had stumbled into it on various projects. I think its bloody awesome and its so awesome I decided to write a tutorial on it. So now your asking: what is libevent?