Mikhail, So I ran into a snag using your method, maybe you can help me a little more. I'm able to cast the abstract pointer to my object, but it isn't a valid pointer to the object. Is there some trick to setting the "abstract" pointer to my object? I'm really confused.
SSHConnection* this_ = static_cast<SSHConnection *>(*abstract); password = this_->getPassword(); But at this point, running my getPassword() function dies because it tries to return the value of a SSHConnection member variable that doesn;t exist because the this_ pointer is not valid. Any ideas? Paul On Dec 15, 2007 1:45 PM, Paul Thomas <[EMAIL PROTECTED]> wrote: > Mikhail , > > Thanks a lot! That example was exactly what I needed to see! I > couldn't figure out any way out of being stuck with using static > member functions. > > thanks, > Paul > > > On Dec 15, 2007 1:15 AM, Mikhail Gusarov <[EMAIL PROTECTED]> wrote: > > "Paul Thomas" <[EMAIL PROTECTED]> writes: > > > > > So when I'm using the library, my class has to have a static member > > > function so that it can be passed into you library as a function > > > pointer. Unfortunately a non-static member function can not be passed > > > into the library. > > > > You've got "abstract" void* pointer attached to every libssh2 to pass > > any context to your handler (use libssh2_session_abstract to access it): > > > > static void > > MyCplusPlusWrapper::keyboardinteractive_handler( > > const char* name, > > int name_len, ..., > > void* abstract) > > { > > MyCplusPlusWrapper* this_ = static_cast<MyCplusPlusWrapper*>(abstract); > > > > this_-> .... > > } > > > > This is pretty common pattern in C world, I'm pretty sure you've seen it > > numerous times under the "ctx" or "context" name. > > > > > 2) Is there any possibility that a future version of libssh2 will give > > > the ability to just do something as simple as: > > > > > > libssh2_userauth_keyboard_interactive( session, username, password) > > > > > > Then if someone like me is using C++, then we aren't stuck only using > > > static functions with keyboard interactive auth. > > > > It's impossible. Have a look at the protocol specification. > > > > > > -- > > JID: [EMAIL PROTECTED] > > > ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel