Use a non-class member as an event handler
问题 I'm writing a DLL wrapper to a C++Builder VCL class. This is an extremely simplified example of the problem: typedef void __fastcall (__closure *TMyEvent)(int index); class TMyClass { public: TMyEvent OnMyEvent; }; void __fastcall myEventHandler(int index) { } TMyClass myClass; myClass.OnMyEvent = myEventHandler; ...and here is the problem: Normally myEventHandler is defined inside another class, but here it is defined as a global function. When I try to assign myEventHandler to myClass