[C++-sig] dumb policy question

Grant Goodyear grant at grantgoodyear.org
Wed Jan 18 22:25:07 CET 2006


I'm currently in the process of modifying some C code so that it can
be accessed from python using boost.python.  I've attached ref.h and
libpyref.cpp (and doref.cpp as a test program for ref.h), and I'm hoping
some kind soul can tell me what I need to do to get this simple snippet
to work correctly.  Right now I get the following:

In [1]:import libpyref

In [2]:ints = [0,0,0,0]

In [3]:libpyref.ref(ints,2)
---------------------------------------------------------------------------
Boost.Python.ArgumentError                             Traceback (most
recent call last)

/home/grant/EMAN2/playground/<console> 

ArgumentError: Python argument types in
    libpyref.ref(list, int)
did not match C++ signature:
    ref(std::vector<int, std::allocator<int> > {lvalue}, int)

I'm not sure if the problem is the policy, or that I need some sort of
typeconverter because what I'm asking is beyond the magic converters
already in boost_python?

Thanks,
Grant Goodyear
-- 
Grant Goodyear		
web: http://www.grantgoodyear.org	
e-mail: grant at grantgoodyear.org	
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ref.h
Type: text/x-chdr
Size: 150 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060118/03bfd459/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libpyref.cpp
Type: text/x-c++src
Size: 524 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060118/03bfd459/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doref.cpp
Type: text/x-c++src
Size: 270 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060118/03bfd459/attachment-0001.cpp>


More information about the Cplusplus-sig mailing list