[C++-sig] How to expose only what I want in Boost python

Danny C dannyc22192 at gmail.com
Sun Jun 24 01:23:27 EDT 2018


Hi,

I am very new to boost python. I am exposing a C++ library using boost
python. I want to expose some constructors and some interfaces. This may
come as very trivial but I don't want to expose my complete class to the
python module, only defs for the interfaces I require. But if i don't
expose everything I get linker errors stating that some members are
undeclared. Is there a workaround for this. Here's what my class looks like:

A.h/A.cpp
class A                        //exported class using dlls
{
....
}

BPWrapper.cpp

class BPWrapper       //Wrapper class holding an instance to A
{
private:
    boost::shared_ptr<A> _mA;
public:
    BPWrapper(args)
    interface1(...)
    interface2(...)
    interface3(...)
    interface4(...)

}
So when I compile BPWrapper I get linker errors for class A which say the
members of A are undeclared for which the definition I've already provided
in include path.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20180624/c9b617ad/attachment.html>


More information about the Cplusplus-sig mailing list