How to declare a C++ member method for a ListNames - WeOnlyDo Discussion board

How to declare a C++ member method for a ListNames (wodSFTP / wodSFTP.NET / wodSFTPdll)

by yumcious, Thursday, March 24, 2005, 11:07 (7185 days ago)

Hi
I'm writing a C++ wrapper for calling the secure FTP commands using the wodsFTPdll library. I'm lost as to how to declare a member callback to handle those commands that needs a callback function e.g. ListNames.

Can you provide a sample as to how this is done? I suspect there is an issue in the conversion of calling conventions.

Cheers
KS

Re: How to declare a C++ member method for a ListN

by wodSupport, Thursday, March 24, 2005, 11:09 (7185 days ago) @ yumcious

Yum,

isn't that declared in sftpdll.h header file?

Re: How to declare a C++ member method for a ListN

by yumcious, Friday, March 25, 2005, 03:21 (7185 days ago) @ wodSupport

Yum,

isn't that declared in sftpdll.h header file?

No sir. I'm referring to the use of the callback as a normal C++ class member function, instead of a standalone function outside of the class.

So, for example, when the ListNames callback is called, the DLL is actually calling one of the wrapped C++ member function. In this case, the callback still has access to all the member variables in the same class. BUt this needs the callback functions to add another DWORD parameter at the front of the callback parameter list.

Yes, I know, I'm asking a tad much. I'm thinking that perhaps I should revert to a class-less standalone function for this SFTP stuff. Wrapping it in a C++ class was a stretch.

Regards
KS

Re: How to declare a C++ member method for a ListN

by wodSupport, Friday, March 25, 2005, 09:51 (7184 days ago) @ yumcious

I think I understand. I suggest you use Sftp_SetTag and Sftp_GetTag. Since it can store any information in the VARIANT, you can store reference to your class inside instance of SFTP. Perhaps that will work for you?