How can I pass a C++ member function to a C API as a parameter
- by michael
Hi,
In my C++ program, I need to call this c API:
GConn* gnet_conn_new (const gchar *hostname,
gint port,
GConnFunc func);
where GConnFunc is defined as:
void (*GConnFunc) (GConn *conn);
My question is if I have a C++ class and have a member function like
Class A {
public:
A();
void my_func (GConn* conn);
}
In my A::A() Constructor, how can I pass this-myfunc to gnet_conn_new as the GConnFunc parameter?
Thank you.