libsigc++ provides a typesafe (at compile time) callback system for standard C++. It allows you to define signals and to connect those signals to any callback function, either a global or a member function, regardless of whether it is static or virtual. It also contains adaptor classes for connection of dissimilar callbacks.
See also the libsigc++ tutorial, the libsigc++ website, and the Signals appendix of the Programming with gtkmm book.
Include the libsigc++ header:
(You may include individual headers, such as
If your source file is
program.cc, you can compile it with:
Alternatively, if using autoconf, use the following in
Then use the generated
DEPS_LIBS variables in the project
Makefile.am files. For example:
PKG_CHECK_MODULES() call should also mention any other libraries that you need to use via pkg-config.
If using CMake, use the following in
pkg_check_modules() call should also mention any other libraries that you need to use via pkg-config.
libsigc++ contains many template functions and template classes/structs, some with many specializations. This reference manual does not show all specializations of those templates that hardly any user will use directly.