CO2 library
Libco2 is a small and high performance object system for C. It is
intended for C developers, that want to do Object Oriented Programming (OOP)
in C. It is possible to use it with or without dynamic memory allocation (i.e.
malloc() and friends).
Disclaimer
This project is really in its infancy, so expect it to change heavily in future releases. I am still considering whether I should merge it with the carbon project. That is why both projects are still in the same git repository.
Features
Libco2 supports the following features:
- Classes and Objects
- Single Inheritance
- Constructors
- Destructors
- Interfaces and Implementations
- Exceptions1
- Explicit run-time type checking (for object types)
Currently the library also contains several basic datatypes for application development. The plan is to extract these classes to a separate library in the future, and rewrite them using carbon. The supported datatypes are:
RefObject: a base object type that implements assisted memory management with reference counting.ReleasePool: hashmap datatype needed forRefObjectReleasePoolItem: hashmap item datatype needed forReleasePoolStringList: Array/List collection datatypeListIterator: Implementation ofIteratorforListSingleton
Future plans
Some future plans are:
-
Enable or disable support for dynamic memory allocation at configuration time.
-
Garbage collection using Boehm garbage collector
-
Split library into smallest core and basic datatypes
As stated before the plan is to split the library in the the smallest core of the library and a separate datatypes library. The datatypes library will be developed in carbon.
-
Add support for nested classes.