views:

887

answers:

5

I am looking for standard tried and tested library in C language (Windows platform) which implements data structures like stacks, queues, trees etc.

I would prefer to have a source code along with it. Writing a library on my own is possible; however, I feel it may be better to opt for some industry standard implementation which may be optimised and less buggy.

Compiler is Visual Studio 2005/2008.

+8  A: 

Glib

Download Glib for Windows here

qrdl
I was looking for some native windows source code which i could incorporate in my project directly. Also GLib comes with lot of other addons which i would not be interested. I just want the data structure library. Will check it in detail though.
Kavitesh Singh
What do you mean by "native windows source"?
qrdl
which compiles on visual c++ without any add on dependencies. Rather i meant, a ANSI C compliant code which compiles in visual c++. when i try to view Glib it takes me GTK+ site. I understand it is some part of library which is part of bigger GTK+ framework. Please correct me if i am wrong.
Kavitesh Singh
In order to compile your app you just need Glib, not a full GTK+ (if you don't use GTK+, of course)
qrdl
http://www.gtk.org/download-windows.htmlIn toolchain section it says this: Specifically, this means that you should not use newer versions of the Microsoft compiler than Visual C++ 6 without knowing exactly what you are doing.I am yet to compile it though on visual studio 2008.
Kavitesh Singh
@Kavitesh Sorry, didn't know that. I'm from UNIX world and don't know much about what's going on in Windows-land
qrdl
+4  A: 
  • GDSL. As per the documents, it is pure ANSI C and should work with Visual C++.
  • C-generic-library
  • Kompimi. C data structure library, with an emphasis on collections. Comes with Visual Studio project files.
Vijay Mathew
GDSL - info from the main page.GSL is developed on Debian GNU/Linux with gcc. It should build on any GNU/linux distribution with gcc. GDSL has been tested with success under the following distributions: Debian Mandrake RedHat I will try compiling in Visual c++.
Kavitesh Singh
Kompimi is in alpha release. I would rather like to have a tried and tested library for my application. Otherwise would have written my own from the books which gives examples.For C-generic library i could not get the code in the download section or even checking out the svn.
Kavitesh Singh
+1  A: 

I know that this answer may be a bit OT, but if you could use C++ in your project you'd have many data structures provided in the STL, which is part of the standard library.

Matteo Italia
Actually my intent of asking was to find a library in C which is somewhat like a standard like STL in C++. Since STL is standard, it has been tried and tested. So if something in C was available, i would know i am using a reliable implementation of data-structures in my code.
Kavitesh Singh
+2  A: 

Check out cbase. Its LGPL (most of the other libraries are GPL) if license is something that concerns you.

My only comment is that it requires C99 or GCC. It uses variadic macros, which aren't C89 compatible. It should compile fine under VC2005/2008.

cbase is a C library of useful functions that simplify systems software development on System V UNIX. The library includes routines for memory management, string parsing, filesystem traversal, subprocess execution, I/O, as well as implementations of common data structures such as linked lists, hash tables, stacks, and queues. The library also includes a high-level interface to Berkeley sockets, and an implementation of a scheduler which has functionality very similar to that of the cron daemon. Note: cbase was formerly known as CFL.

Corey Stup
+1  A: 

You might want to have a look at http://www.liblfds.org/

gio