Convert C++ function pointer to c function pointer

后端 未结 7 1124
无人共我
无人共我 2020-12-01 04:42

I am developing a C++ application using a C library. I have to send a pointer to function to the C library.

This is my class:

 class MainWindow : pub         


        
7条回答
  •  忘掉有多难
    2020-12-01 05:16

    If I recall it correctly, Only static methods of a class can be accessed via "normal" C pointer to function syntax. So try to make it static. The pointer to a method of a class needs extra information, such as the "object" (this) which has no meaning for a pure C method.

    The FAQ shown here has good explanation and a possible (ugly) solution for your problem.

提交回复
热议问题