>> I would like to be able to "load" and "unload" such functions on demand...
Function pointers might be what you are looking for. For example...
You can read up more on function pointers here: http://www.function-pointer.org/
using namespace std;
void foo(int param)
cout << "foo(" << param << ")" << endl;
void bar(int param)
cout << "bar(" << param << ")" << endl;
typedef void (*foobar_func_t)(int);
// "foobar_func_t" is now a function pointer type
foobar_func_t fb = NULL;
for (int n = 0; n < 10; n++)
// odd numbers call bar()
if (n & 1)
fb = &bar;
fb = &foo;