passing functor as function pointer

后端 未结 10 2245
旧巷少年郎
旧巷少年郎 2020-11-29 03:52

I\'m trying to use a C library in a C++ app and have found my self in the following situation (I know my C, but I\'m fairly new to C++). On the C side I have a collection of

10条回答
  •  萌比男神i
    2020-11-29 04:23

    Many C APIs that take function pointer callbacks have a void* parameter for user state. If you've got one of those, you're in luck - you can use an exterm C function that treats the user data as some sort of reference or key to lookup the functor, then execute it.

    Otherwise, no.

提交回复
热议问题