[C++-sig] Base class defined in other header file not includedin bp::bases<>

Haridev, Meghana mharidev at qualcomm.com
Thu Jul 13 20:20:09 CEST 2006


Hi Roman,

Thanks for your help!

 

Another question:

 

Say that I have already written manually boost-python wrappers for baseB
class (present in different directory) and have a shared library for it.


 

Now I want to use pyplusplus to generate the boost-python wrappers for
derivedC class.

 

Like you suggested, if I add: mb.class_( 'baseB' ).include()

It will give me the following generated code:

 

    bp::class_< baseB >( "baseB" );

    bp::class_< baseA >( "baseA" );

    bp::class_< derivedC, bp::bases< baseA, baseB > >( "derivedC" );

 

But what if I don't want pyplusplus to expose baseB again (I am going to
link baseB's shared library with derivedC's boost wrapper) but I still
want it to appear in bp::bases - is it possible to do that using
pyplusplus?

 

In other words, I want the generated code to look like this:

 

    /* bp::class_< baseB >( "baseB" );  - Do not want to generate */

    bp::class_< baseA >( "baseA" );

    bp::class_< derivedC, bp::bases< baseA, baseB > >( "derivedC" );

 

Thanks,

-Meghana.

 

-----Original Message-----
From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] On
Behalf Of Roman Yakovenko
Sent: Wednesday, July 12, 2006 10:19 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] Base class defined in other header file not
includedin bp::bases<>

 

On 7/13/06, Haridev, Meghana <mharidev at qualcomm.com> wrote:

> Hi Folks,

> I'm having some trouble generating boost-python wrapper code using

> pyplusplus for a derived class which has one of its base classes
defined in

> another file.

 

> How can I get pyplusplus to add 'baseB' to bp::bases<> for 'derivedC'
class

> when 'baseB' class is defined in another file (present in the same
directory

 

If "other.hpp" presents in the same directory it will just work.

 

> or different directory)?

 

In this case baseB class will be excluded. The idea behind such

behaviour is next:

there is one directory that contains library interface and many

directories that contain

implementation details. So, by default pyplusplus excludes from
generation all

declarations defined in other directories. You can find more information
here:

http://language-binding.net/pyplusplus/tutorials/module_builder/module_b
uilder.html

 

Next few lines of code will include baseB:

 

mb = module_builder_t( ... )

mb.class_( 'baseB' ).include()

#or if you want to include all declarations from directory Y:

mb.decls( header_dir=Y ).include()

 

I hope, this will help you.

 

-- 

Roman Yakovenko

C++ Python language binding

http://www.language-binding.net/

_______________________________________________

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/20060713/789e1091/attachment.htm>


More information about the Cplusplus-sig mailing list