I have function, lets say foo, in lib which accepts callback:
typedef void (*CallbackType)(unsigned int);
void foo(const tchar* path, CallBackType); // library function
static void boo(unsigned int percent)
{
static ProgressBarClass progressBar;
progressBar.setProgressValue(percent);
}
but I can't have object progressBar to be static, so I thought I will bind reference to it:
static void boo(unsigned int percent, ProgressBarClass& progressBar)
{
progressBar.setProgressValue(percent);
}
void something() {
ProgressBarClass progressBar;
tr1::function<static void(unsigned int)> f = tr1::bind(boo, tr1::placeholders::_1, tr1::ref(progressBar));
foo(someWCHARPath, f);
}
but of course I can't convert tr1::function to ansi c callback, so the question is is there anything nice and clean what can I do? Can I bind progressBar is some way to ansi c callback?