Re: [gnet] Using GNet callbacks with C++



Option 1:
Make member function static. Note it will only be able to access static members of the class.

Option 2:
struct SomeClass {
  int member;

  int typical_cplusplus_bloat_member_function() {
    return( member );
  }
}

int some_class_typical_cplusplus_bloat_member_function( SomeClass *sc ) {
  return( sc->typical_cplusplus_bloat_member_function() );
}


Michael Alger wrote:
Is there any (clean) way of using GNet in a C++ application, where the
callback functions are wanting to be member functions of a class? I've
searched around for a C++ wrapper or any mention at all of how to do
this, but to no avail.

Would I be better off just looking for an alternative library, and if
so, any recommendations?  I mostly need Linux+Win32 support, and *BSD
would be a bonus.

TIA,
Mike.
_______________________________________________
gnet mailing list
gnet gnetlibrary org
http://www.gnetlibrary.org/mailman/listinfo/gnet


--

ssh aron rubinium org cat /dev/brain | grep ^work:

Aron Rubin                       Member, Engineering Staff
Lockheed Martin                  E-Mail: arubin atl lmco com
Advanced Technology Laboratories Phone:  856.792.9865
3 Executive Campus               Fax:    856.792.9930
Cherry Hill, NJ USA 08002        Web:    http://www.atl.lmco.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]