>> 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...
Code:
#include <iostream>
using namespace std;
void foo(int param)
{
cout << "foo(" << param << ")" << endl;
}//foo
void bar(int param)
{
cout << "bar(" << param << ")" << endl;
}//bar
typedef void (*foobar_func_t)(int);
// "foobar_func_t" is now a function pointer type
int main()
{
foobar_func_t fb = NULL;
for (int n = 0; n < 10; n++)
{
// odd numbers call bar()
if (n & 1)
fb = &bar;
else
fb = &foo;
fb(n);
}//for
return 0;
}//main
You can read up more on function pointers here: http://www.function-pointer.org/
gg