ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
C++ style functions with aw_event_set (Sdk)
C++ style functions with aw_event_set // SdkokhanFeb 27, 2000, 3:25am
Hi,
I'm using Visual C++ and classes to implement the required functions for my bot. When I exectue the call aw_event_set(SOME EVENT, function) I get the error: 'aw_event_set' : cannot convert parameter 2 from 'void (void)' to 'void (__cdecl *)(void)' The function shown above is a function declared both in the header file (class definition) and in a cpp file with the typical CLASS::function {} implementation. Does anyone know how I can get around this problem and get aw_event_set to accept the passed function? Thanks, Omar Khan faberFeb 27, 2000, 7:54am
An aw callback function must use the c style calling convention.
A class member function can only be used for that if the member function is declared as static. Note that a static member function is not bound to any object of the class, and hence does not have access to the member variables or other member functions since it does not have an object of its own. Access is possible only if a pointer to the object is available, as if the static class member function was not a member of that class. Faber "okhan" <ohk2 at cornell.edu> schrieb im Newsbeitrag news:38b8b553$1 at server1.Activeworlds.com... > Hi, > > I'm using Visual C++ and classes to implement the required functions for my > bot. When I exectue the call > > aw_event_set(SOME EVENT, function) > > I get the error: > > 'aw_event_set' : cannot convert parameter 2 from 'void (void)' to 'void > (__cdecl *)(void)' > > The function shown above is a function declared both in the header file > (class definition) and in a cpp file with the typical CLASS::function {} > implementation. > > Does anyone know how I can get around this problem and get aw_event_set to > accept the passed function? > > Thanks, > > Omar Khan > > |