callback function context value

Johnathan Burchill <[email protected]> Tue, 27 Apr 2004 09:41:20 -0600
Newsgroups gmane.comp.sysutils.backup.dar.libdar
Message-ID <[email protected]>
Hi Denis,

Apparently it is standard coding practice for API callback functions to 
accept a "context value", which is a void *, that allows one to use a 
class member function as a callback without resorting to a global pointer 
variable.

As I understand dar, it uses a regular function as the callback. Could you 
add perhaps a new set of callback setting functions to the libdar API that 
accept a void * context value to be passed. It would be easy to keep 
backwards compatibility with earlier libdar versions by redefining the 
standard callback setting functions to call the new ones with NULL for the 
void *.

There is a good tutorial at
http://www.function-pointer.org/callback.html
#3:  How to Implement Callbacks in C and C++

In the examples given, I currently use method B, but it would be better to 
use method A to avoid using the global variable.

Cheers,
JB

-- 
Johnathan K. Burchill, Ph.D.
[email protected]
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQBAjn8lrXMSOtiWrO4RAk/AAJ9Y/aX866F4xw3ekXWlIKtc91C/pQCg57R7
94HmJ4lc7AcFtH/DxX5Cico=
=NrnG
-----END PGP SIGNATURE-----