ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Re: passing a dynamic PyObject * from C++ to Python
by David Abrahams other posts by this author
Jun 25 2003 6:33PM messages near this date
Re: [C++-sig] Simply calling a routine ... | Re: [C++-sig] Re: passing a dynamic PyObject * from C++ to Python
"F. Oliver Gathmann" <gathmann@[...].com>  writes:

>  With Boost.Python v2, I have not been able to find an equivalent
>  solution; I tried various approaches gathered from the Boost.Python
>  FAQ and documentation, e.g.

Nicodemus has nearly finished building/documenting a function which
allows you to register conversions from any smart pointer to Python.
See recent posts to this list.  You could use that.


>    template <class T> T identity(T x) {   return x; } template <class
>    T> object get_pointer_reference(T x) {   object f =
>    make_function(&identity<T>,
>    return_value_policy<manage_new_object>()
>  			     );   return f(x); }

Hmm, *nasty* formatting!

  template <class T>  
  T identity(T x) {
     return x;
  }

  template <class T>  
  object get_pointer_reference(T x)
  {   
      object f = make_function(
        &identity<T> , return_value_policy<manage_new_object>());

      return f(x);
  }

Hmm, looks OK to me.

>  which compiles fine but crashes at runtime (using gcc 3.2.2 on Linux
>  with a recent CVS version of Boost). Any hints that might help me
>  solving this mystery would be much appreciated!

Any hints about the condition of the program at the time of crash
would be a big help in helping you.  A reproducible test case would
be even better.


-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
F. Oliver Gathmann
christophe grimault
David Abrahams
F. Oliver Gathmann
christophe grimault
Charles Leung
Philip Austin
Nicodemus
David Abrahams
F. Oliver Gathmann

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved