[C++-sig] void* questions\thoughts
Niall Douglas
s_sourceforge at nedprod.com
Mon Oct 31 15:12:22 CET 2005
On 31 Oct 2005 at 15:27, Roman Yakovenko wrote:
> Hi. There is nice explanation in boost.python FAQs how to export
> function that takes\returns
> void*. I have 2 questions:
>
> 1. Why void_ should be defined in each translation unit? If I understand right
> "translation unit" is cpp file?
void_ is a placeholder type for void as BPL doesn't support the void
type itself, but does support opaque types. Hence the unfortunate
proxy use of void_ * for void *.
> If there is no special reason to define void_ in every translation
> unit, then next question:
>
> 2. Why boost.python does not define void_ class and does not registrate it?
> BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID( void_ )
I would personally wonder why BPL doesn't automatically treat void as
an opaque type, and thus you can use void *. A huge amount of C uses
void *, and a good proportion of C++ so lacking it makes producing
bindings for such C and C++ trickier than it needs to be - most
importantly in wrapping virtual functions, where a void * is passed
in and must be passed out as-is to the C++ default implementation.
Dave, what was the rationale for not supporting void as an opaque
type?
Cheers,
Niall
More information about the Cplusplus-sig
mailing list