Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is there any Boost equivalent library for C?

share|improve this question

closed as off-topic by GlenH7, MichaelT, gnat, Bart van Ingen Schenau, Dan Pichelman Dec 30 '14 at 17:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – GlenH7, MichaelT, gnat, Bart van Ingen Schenau, Dan Pichelman
If this question can be reworded to fit the rules in the help center, please edit the question.

9  
What do you mean by "Boost equivalent"? If you mean "a library for making the best use of C++ template metaprogramming features", then no, that wouldn't make sense for C. If you just mean "batteries included", then that's not really what Boost is anyway - a lot of obvious "batteries" (xml, other useful file formats, ...) aren't there whereas some very non-obvious choices are. Do you really want a library containing "you know, just a load of stuff" anyway, or do you have some specific needs? –  Steve314 Oct 28 '11 at 3:49
3  
Boost is a project that's very close to WG21, the ISO C++ group. That's why so many boost features made it into C++11. There's no equivalent project associated with WG14, the ISO C group. –  MSalters Oct 28 '11 at 10:10
1  
@Steve314 In fact template metaprogramming is an equivalent of C's macro metaprogramming, so a Boost for C is in theory possible (-; –  mbq Oct 28 '11 at 11:13
    
@mbq - last time I checked, C macros are not Turing complete. Maybe I'm wrong, though - e.g. can a macro recursively call itself? –  Steve314 Oct 28 '11 at 14:22
    
@Steve314 With a little cheating with build or m4 yes; yet I doubt this is a crucial Boost's requirement. –  mbq Oct 28 '11 at 15:42

3 Answers 3

up vote 21 down vote accepted

The best I can think of is the Apache Portable Runtime project.

From Wikipedia on APR:

The Apache Portable Runtime (APR) is a supporting library for the Apache web server. It provides a set of APIs that map to the underlying operating system (OS). Where the OS doesn't support a particular function, APR will provide an emulation. Thus programmers can use the APR to make a program truly portable across platforms.

APR originally formed a part of Apache HTTP Server, but the Apache Software Foundation spun it off into a separate project. Other applications can use it to achieve platform independence.

Functionality:

  • Memory allocation and memory pool functionality
  • Atomic operations
  • Dynamic library handling
  • File I/O
  • Command-argument parsing
  • Locking
  • Hash tables and arrays
  • Mmap functionality
  • Network sockets and protocols
  • Thread, process and mutex functionality
  • Shared memory functionality
  • Time routines
  • User and group ID services
share|improve this answer

Another candidate would be Glib. It provides a bunch of functionality that is very useful, but not part of the C language or the C library. Stuff that is in the standard API in languages like Java or C#:

GLib is a cross-platform software utility library that began as part of the GTK+ project. [...] GLib provides advanced data structures, such as memory chunks, doubly and singly linked lists, hash tables, dynamic strings and string utilities [...] GLib implements functions that provide threads, thread programming and related facilities [...] Some other features of GLib include:

  • standard macros
  • warnings and assertions
  • dynamic loading of modules
  • a type system, GType
  • an object system, GObject

( Source: http://en.wikipedia.org/wiki/Glib )

share|improve this answer

Core Foundation is a framework written in C by Apple.

It has:

  • File IO
  • Networking
  • Bundle loading
  • String manipulation (with Unicode support!)
  • Data manipulation
  • Interprocess communication
  • Date handling
  • XML parsing
  • Localization
  • Easy memory management (using reference counting)
  • Property lists (kind of file format to hold data)
  • Streaming
  • Arrays, sets, dictionaries, bags and bitvectors
  • Notifications (kind of goto but you don't know where they go, powerful but watch out)
  • Endianness translation
  • Much more

If you need to support operating systems that are not Mac OS X, you can use CFLite which is open source.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.