AW: [C++-sig] functions whose return type is a pointer

Gottfried.Ganssauge at HAUFE.DE Gottfried.Ganssauge at HAUFE.DE
Fri Jan 24 16:15:11 CET 2003


Here you are.
I made a test program in the test directory and ran it successfully with
msvc.

Unfortunately I wasn't as successful with gcc :-(
Neither gcc-2.95.2 nor gcc-3.2 would accept the code:
With gcc-3.2 the following messages were generated:
cd /home/gotti/temp/boost/libs/python/test/
bjam opaque
...found 1773 targets...
...updating 4 targets...
gcc-C++-action
../../../libs/python/test/bin/opaque_ext.so/gcc3.2/debug/runtime-link-dynami
c/shared-linkable-true/opaque.o
/home/gotti/temp/boost/boost/python/type_id.hpp: In function 
   `boost::python::type_info boost::python::type_id(boost::type<T>*) [with T
= opaque_]':
/home/gotti/temp/boost/boost/python/lvalue_from_pytype.hpp:22:
instantiated from `boost::python::type_info
boost::python::detail::extractor_type_id(T&(*)(U)) [with T = opaque_, U =
boost::python::convert_opaque_pointer<opaque_*>::instance&]'
/home/gotti/temp/boost/boost/python/lvalue_from_pytype.hpp:87:
instantiated from `boost::python::lvalue_from_pytype<Extractor,
python_type>::lvalue_from_pytype() [with Extractor =
boost::python::convert_opaque_pointer<opaque_*>, const
PyTypeObject*python_type =
(&boost::python::convert_opaque_pointer<opaque_*>::type_object)]'
/home/gotti/temp/boost/boost/python/opaque_pointer_converter.hpp:40:
instantiated from
`boost::python::convert_opaque_pointer<Pointer>::convert_opaque_pointer(cons
t char*) [with Pointer = opaque_*]'
opaque.cpp:26:   instantiated from here
/home/gotti/temp/boost/boost/python/type_id.hpp:56: invalid use of undefined
type `struct opaque_'
opaque.cpp:7: forward declaration of `struct opaque_'
/home/gotti/temp/boost/boost/python/type_id.hpp: In function 
   `boost::python::type_info boost::python::type_id(boost::type<T>*) [with T
= const volatile opaque_&]':
/home/gotti/temp/boost/boost/python/converter/registered.hpp:50:
instantiated from `const
boost::python::converter::registration&boost::python::converter::detail::reg
istered_base<const volatile opaque_&>::converters'
/home/gotti/temp/boost/boost/python/converter/arg_from_python.hpp:276:
instantiated from
`boost::python::converter::pointer_arg_from_python<T>::pointer_arg_from_pyth
on(PyObject*) [with T = opaque_*]'
/home/gotti/temp/boost/boost/python/arg_from_python.hpp:79:   instantiated
from `boost::python::arg_from_python<T>::arg_from_python(PyObject*) [with T
= opaque_*]'
/home/gotti/temp/boost/boost/python/arg_from_python.hpp:51:   instantiated
from `boost::python::detail::nullary<T>::nullary(PyObject*) [with T =
boost::python::arg_from_python<opaque_*>]'
/home/gotti/temp/boost/boost/python/detail/caller.hpp:35:   instantiated
from `PyObject* boost::python::detail::caller_arity<1>::impl<F,
ConverterGenerators, Policies, Sig>::operator()(PyObject*, PyObject*) [with
F = void (*)(opaque_*), ConverterGenerators =
boost::python::detail::args_from_python, Policies =
boost::python::default_call_policies, Sig = boost::mpl::list2<void,
opaque_*>]'
/home/gotti/temp/boost/boost/function/function_template.hpp:117:
instantiated from `static R
boost::detail::function::function_obj_invoker2<FunctionObj, R, T0,
T1>::invoke(boost::detail::function::any_pointer, T0, T1) [with FunctionObj
= boost::python::detail::caller<void (*)(opaque_*),
boost::python::detail::args_from_python,
boost::python::default_call_policies, boost::mpl::list2<void, opaque_*> >, R
= PyObject*, T0 = PyObject*, T1 = PyObject*]'
/home/gotti/temp/boost/boost/function/function_template.hpp:481:
instantiated from `void boost::function2<R, T0, T1,
Allocator>::assign_to(FunctionObj,
boost::detail::function::function_obj_tag) [with FunctionObj =
boost::python::detail::caller<void (*)(opaque_*),
boost::python::detail::args_from_python,
boost::python::default_call_policies, boost::mpl::list2<void, opaque_*> >, R
= PyObject*, T0 = PyObject*, T1 = PyObject*, Allocator =
std::allocator<boost::function_base>]'
/home/gotti/temp/boost/boost/function/function_template.hpp:432:
instantiated from `void boost::function2<R, T0, T1,
Allocator>::assign_to(Functor) [with Functor =
boost::python::detail::caller<void (*)(opaque_*),
boost::python::detail::args_from_python,
boost::python::default_call_policies, boost::mpl::list2<void, opaque_*> >, R
= PyObject*, T0 = PyObject*, T1 = PyObject*, Allocator =
std::allocator<boost::function_base>]'
/home/gotti/temp/boost/boost/function/function_template.hpp:293:
instantiated from `boost::function2<R, T0, T1,
Allocator>::function2(Functor,
boost::detail::function::enable_if<boost::type_traits::ice_not<boost::is_sam
e<Functor, int>::value>::value, int>::type) [with Functor =
boost::python::detail::caller<void (*)(opaque_*),
boost::python::detail::args_from_python,
boost::python::default_call_policies, boost::mpl::list2<void, opaque_*> >, R
= PyObject*, T0 = PyObject*, T1 = PyObject*, Allocator =
std::allocator<boost::function_base>]'
/home/gotti/temp/boost/boost/python/make_function.hpp:36:   instantiated
from `boost::python::api::object boost::python::detail::make_function_aux(F,
const CallPolicies&, const ConverterGenerators&, const Sig&) [with F = void
(*)(opaque_*), CallPolicies = boost::python::default_call_policies,
ConverterGenerators = boost::python::detail::args_from_python, Sig =
boost::mpl::list2<void, opaque_*>]'
/home/gotti/temp/boost/boost/python/make_function.hpp:76:   instantiated
from `boost::python::api::object boost::python::make_function(F) [with F =
void (*)(opaque_*)]'
/home/gotti/temp/boost/boost/python/def.hpp:84:   instantiated from `void
boost::python::def(const char*, Fn) [with Fn = void (*)(opaque_*)]'
opaque.cpp:32:   instantiated from here
/home/gotti/temp/boost/boost/python/type_id.hpp:56: invalid use of undefined
type `struct opaque_'
opaque.cpp:7: forward declaration of `struct opaque_'

Cheers,

Gottfried

> -----Ursprungliche Nachricht-----
> Von: David Abrahams [mailto:dave at boost-consulting.com]
> Gesendet: Donnerstag, 23. Januar 2003 19:20
> An: c++-sig at python.org
> Betreff: Re: [C++-sig] functions whose return type is a pointer
> 
> 
> Gottfried.Ganssauge at HAUFE.DE writes:
> 
> > I would love to prepare a patch for the opaque pointer 
> issue if someone
> > could explain the proper procedure to me.
> 
> And I'd love to apply such a patch.
> 
> All you have to do is make the changes in your CVS tree, and then use
> "cvs diff -NR -u" from the boost root directory.  Stick the result in
> an enclosure and post it.
> 
> Thanks,
> Dave
> 
> -- 
>                        David Abrahams
>    dave at boost-consulting.com * http://www.boost-consulting.com
> Boost support, enhancements, training, and commercial distribution
> 
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030124/d9442704/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opaque_pointer_converter.patch
Type: application/octet-stream
Size: 5516 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030124/d9442704/attachment.obj>


More information about the Cplusplus-sig mailing list