Original Post
Hi, I just read a couple of articles on member function pointers. Seems a pretty obfuscated corner of C++. Anyway, I'm trying to make an extension SDK for one of my projects, using DLLs. Ideally the developer should create a class to represent their object in the application. The application needs to end up calling member functions of this class (which I'll call UserClass). UserClass is derived from an abstract class, ExtensionClass, defining standard routines such as Draw(). UserClass returns to the application some member function pointers for various new routines specific to that UserClass implementation. All the routines take 1 standard parameter. The application knows that the extension is a derivative of ExtensionClass, but needs to call one of the specific routines, via one of the returned member function pointers. It also has the pointer to the UserClass, but because the type is not specifically known (it is defined only in the DLL), the pointer will have to be considered an ExtensionClass pointer. When the application calls the member function, will it work? I.e. ExtensionClassPtr->*UserClassMemberPtr(param); even though the user class function is not known by the application. I understand this is a very implementation specific problem. I'm on VC++ 6.0, and not worried about portability. The call should be fast and efficient, but not worried about dropping 3 or 4 cpu cycles per call. Or should I just forget it and use ordinary DLL exports? Would Fast Delegates as suggested by http://www.codeproject.com/cpp/FastDelegate.asp be a good idea? Or I also read about boost::function? What's the best way to tackle this? Thanks all