[C++-sig] Avoiding duplicate registration of Py++ generated array code?

Haridev, Meghana mharidev at qualcomm.com
Fri Jan 19 03:45:07 CET 2007


Hi Folks,

 

I am using Py++ for the generation of boost.python wrappers for 2
libraries/modules. 

 

Boost_Lib1.so: Wraps C++ source code that looks like this:

Class A {

public:

     uint8 dataA[128];

};

 

Class B {

public:

     uint8 dataB[128];

};

 

Boost_Lib2.so: Wraps C++ source code that looks like this:

Class C {

public:

    uint8 dataC[128];

 

};

 

Note that all the arrays data, dataB, dataC are of the SAME TYPE and
SIZE.

 

The class template code instantiation that is generated to wrap all 3
array member variables by Py++ looks like this:

pyplusplus::containers::static_sized::array_1_t< unsigned char, 128>
....

 

I am aware that Py++ takes care of duplicate registration within a
module i.e. this registration code is generated only once while wrapping
dataA[128] and not generated for wrapping dataB[128]:

pyplusplus::containers::static_sized::register_array_1< unsigned char,
128, bp::default_call_policies >( "__array_1_unsigned_char_128" );

 

But when I have an array (dataC) of the SAME TYPE and SIZE but wrapped
in a different module, I get this warning for duplicate registration
when I import the 2nd module:

>> import Boost_Lib1

>> import Boost_Lib2

>> RuntimeWarning: to-Python converter for
pyplusplus::containers::static_sized::array_1_t<unsigned char, 128>
already registered; second conversion method ignored.

 

Questions:

1) How can I avoid duplicate registration across modules? 

2) Is there any known way by which I can get rid of this warning? 

3) I know that this warning can be gotten rid of by adding another
template parameter (like a unique string across modules) - If I plan on
incorporating this, is there a lot of effort required? Pointers to which
files that might need to be modified would be much appreciated! 

 

Thanks,

-Meghana.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070118/a700a08d/attachment.htm>


More information about the Cplusplus-sig mailing list