Pop quiz hotshot: You're on a bus with no Internet connection. You absolutely need to interface some new C++ code with a shoddy old C interface based on function pointers. The new C++ code makes heavy use of functors to carry state between call invocations. The C code must call these C++ functors by way of a function pointer, and only a function pointer. Your function pointer prototype cannot take any additional arguments for the class type. What do you do? What do you do...
↧