Thursday, September 6, 2007

What is Boost.Reflection?

Boost.Reflection is similar to, and can be used together with, Boost.Extension. However, it allows for creating and using objects without having access to the definition of the class or one of its base classes (Boost.Extension requires having access to one of a class's base classes).

  1. Use arbitrary information to describe a class
  2. Instantiate a class
  3. Call its methods by arbitrary identifiers (although you can use strings to identify methods, it is possible to use any arbitrary information to select them)
  4. Fast function calls - you only have the overhead of two functions called by function pointers.
  5. Call functions without knowing what parameters they require.
  6. Containers indexed by type.
Information about Boost.Reflection is currently contained in the Extension docs. Especially check out the following:

reflection.hpp reference
reflector reference
Extension/Reflection interoperability

What is Boost.Extension?

Boost.Extension is a C++ library designed primarily to ease the creation of plugins. It allows for creating shared libraries that can be loaded by an executable, and which can implement interfaces defined in the executable. The executable can then instantiate and use these implementations.

  1. Type-safety
  2. Arbitrary information can be stored about a plugin (version info, size, requirements etc.)
  3. Fast - you access implementations through pointers to their interfaces, so you only have the normal overhead of a virtual function call
  4. Thread-safe
  5. Cross-platform (Windows, Mac, and Linux have all been tested)
  6. RTTI is optional

Tuesday, September 4, 2007


I've revamped the interface for Boost.Extension, to make it more concise. The main difference is that the RTTI requirement is easier to avoid now.

Option 1:

You can have separate containers for each set of constructors for a specific interface.

Option 2:

You can declare your own type of type info - perhaps just integers or strings.

The latest change makes option one easier.

A recent checkin in Boost.Build seems to have broken the build for documentation. If you have trouble generating the documentation, you may have to wait a few days until I check the latest docs into in the sandbox. I managed to get the docs compiling successfully on Ubuntu, and should have the updates posted in three to four days.