Useful Open Source Libraries

Of course you won’t program everything from scratch, but there are situations where you can hesitate to create your own libraries or not.
In many cases the work involved and the results you can achieve with your own libraries is enough to satisfy your requirement but in other situations it isn’t even close.
One of the best things of programming in C/C++ is that there is plenty of resources of any kind to satisfy a wide variety of needs, usually there is more than one solution for one requirement.
There are Open Source and Closed Source libraries, and they can be free or paid, maybe free for non commercial projects or under a specific license.
Not all Open Source libraries are free, and even not all the free ones can be used in commercial projects, even more, there are some of them that allows you to dynamically link to your code for commercial use but not to statically link. Some licenses requires you to make the source of your project public. Many licenses as well require you to make public the changes you made to the library so you share any possible improvement.

Here at South Winds Games we use many 3rd party libraries.

ZLIB
For compressing and decompressing data we use the ZLIB
Zlib is very handy and easy to integrate and it has a very permissive license, you can statically link it to your code and you don’t need to even name them (we prefer to do it). ZLib is fast and well documented, it has been written in C so it has bindings to many languages, it is completely multi-platform. I don’t thing there is a replacement for it.


For reading XML we use irrXML, we tried many other like TinyXML and libxml bur IrrXML situed best for our requirements.
IrrXML uses the same license of ZLIB. One problem IrrXML has is that it doesn’t support UTF-8 despite it says it does, but it works perfectly with all the other encodings.
IrrXML doesn’t provides a tool to write xml files, so we coded our own. If you were looking for a tool to write XML in UTF8 format (the only format it supports) here you can grab ours: xmlwriter (it has a zlib license as well). IrrXML is a C++ library and I guess it is only supported in C++, it works on Mac OS X on Intel and PowerPC computers as well as Windows, it should work on Linux as well.

libpng
To read PNG graphic files we use libpng. The libpng library internally uses the zlib so you should take this into account to only have one instance of the zlib in your linking process. The libpng is distributed with the the zlib license and there are plenty of bindings for many languages as it has been written in C. It is updated regularly.


We also use the jpeglib which allow us to read JPEG graphic files. This library was last updated in 1998 but it seems that it isn’t a problem.
This library has a different license which require you to add this line in a part of your software documentation (the readme would be the best place).

“this software is based in part on the work of the Independent JPEG Group”.

Also the lib has been written in C and it shouldn’t take too much work to bind it to other languages.


From the xiph open source community we use two very important libraries and archive formats, both related to media, one for sound and other for video.

ogg vorbis
For sound we use the Ogg-Vorbis royalty free format. The quality obtained with the ogg format is head to head with the mp3’s one and if you use the famous mp3 format you must pay royalties, both are very similar one is free, the decision is easy.

Theora
For video playback we had the non reliable CODEC problem: You can use the operative system services to stream video, you have directshow on windows or the Windows Video Api and QuickTime on MacOs X but unfortunately Windows only had very bad codecs installed by default. Other option is to include the codecs on the download, but as well many of them require royalties, so we opted for the multi-platform royalty free way of doing the things. Theora is not hardware accelerated so it uses the CPU to decode the video which is not a fast process, but it is well optimized to run smoothly on a Pentium III 750 mhz (our low-end testing machine).

Both libraries are written in C and well documented, there are bindings to many languages for them.
Both libraries use the BSD license which is a variation of the MIT license. This allow you to close the code and use it on commercial projects, but you must include somewhere in your software documentation the copyright license included in the library.

We recommend you to read all the licenses of all the libraries you are using, some libraries aren’t as permissive and some others may require you to mention them or show in your software the copyright message attached to the library.

- Juan Pablo

2 Comments »

  1. Turkos Said,

    April 7, 2009 @ 7:03 am

    Hello Juan Pablo, generally do not write on your blog because my English is very bad, but I found this article interesting, I think there are many variants with respect to the licenses is the GNU GPL and the LGPL, and each one is results in others. The important thing is that when you see what our project will follow this example and that the GPL allows us to make commercial code, which will be free and should also mention the author and the changes we make, I think this allows us to have applications very good quality as the compilers gcc, g + +, mozilla, netscape that are truly outstanding and are not compared to other proprietary software applications. I think open source is a good concept for large applications, as mentioned by Eric S. Raymond in his book The Cathedral and the Bazaar

  2. Juan Pablo Said,

    April 7, 2009 @ 7:24 am

    Hola Turkos!
    I’m glad you found this article interesting.
    I have written it just for the sake of colaboration. Many starters programmers don’t know about licenses and used to confuse them and missuse the open source code.
    See you!

RSS feed for comments on this post · TrackBack URI

Leave a Comment