vendredi 22 juillet 2016

How to set function address of C++ class method for non-C++ function calls?

The openssl library provides a way to write your own BIOs. Essentially you load a struct of function pointers to read, write, create, destroy, etc, routines that the openssl lib will use.

I am trying of wrap this functionality in a C++ class. openssl has routines to set the function pointers of the structure it uses, like:

BIO_meth_set_read(pBIOMethod, my_function_for_read); 

Question: can I use a class method for my_function_for_read? In other words, can the address of a class method be invoked as a regular function in an external library that is C-based?

I am not sure if the class vtable is used if I take the address of just that class method.

Thanks, -Andres

Aucun commentaire:

Enregistrer un commentaire