Using C + + class member functions as C callback functions

I have a C library that needs a callback function to be registered to customize some processing. Type of the callback function is int a(int *, int *).

I am writing C++ code similar to the following and try to register a C++ class function as the callback function:

class A {
   int e(int *k, int *j);


A::e(int *k, int *e)
  return 0;



The compiler throws following error:

In constructor 'A::A()',
 argument of type ‘int (A::)(int*, int*)’ does not match ‘int (*)(int*, int*)’.

My questions:

  1. First of all is it possible to register a C++ class memeber function like I am trying to do and if so how? (I read 32.8 at But in my opinion it does not solve the problem)
  2. Is there a alternate/better way to tackle this?
This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.
About the author