如何在类中定义libusb_log_cb函数?

问题描述

如何在类内部定义libusb_log_cb函数?我需要访问此类的变量。

例如:

foo.h

class foo
{
    ...
private:
    int r;
    void handleLog(libusb_context *ctx,enum libusb_log_level level,const char* str);
};

foo.cpp

...

void foo::handleLog(libusb_context *ctx,const char* str)
{
    ...
    std::cout << r << "\n";
}

...

libusb_set_log_cb(...,handleLog,...); // Error. Cause this function is a member of the foo class

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)