[C++-sig] Re: Methods returning & taking pointers to functions

Mike Rovner mike at nospam.com
Fri Oct 3 23:06:29 CEST 2003


Niall Douglas wrote:
> I /think/ these don't compile properly ie; lots of compiler warnings.
> Unfortunately a mechanism of specifying a sort function is
> commonplace in my library and ultimately I'll really need it.
>
> I see a two pronged approach: (i) make a pointer to a function an
> opaque type and (ii) write a thunk which invokes an arbitrary python
> function. The latter, through some small alterations to the base
> library, could be entirely driven by parameters (all I need is a
> pointer to the thing calling the sort function).
>
> Has anyone else tried this? Is it even possible? If BP can't wrap
> methods taking or receiving pointers to functions, then it's a non-
> starter.

FWIW take a look at
http://www.python.org/cgi-bin/moinmoin/boost_2epython_2fHowTo#head-c731dcfc007c502c41166c7a524780cb43a16bab -
How to wrap a "raw" function.

HTH,
Mike







More information about the Cplusplus-sig mailing list