[smart_holder]: trampoline_self_life_support -fvisibility question
Open
@rwgk is already working on this.
Since May 9, 2022.
smart holder
triage
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
Problem description
I'm attempting to use the Progressive mode to solve a lifetime issue with a trampoline class via the following steps:
- Added
-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULTto compilation commands - Replaced
std::shared_ptr<...>holder withPYBIND11_SH_DEF(Foo) - Inherit trampoline class from
public py::trampoline_self_life_support
When I compile, I get this warning:
warning: ‘PyFoo’ declared with greater visibility than its base ‘pybind11::trampoline_self_life_support’ [-Wattributes]
134 | class PyFoo : Foo, py::trampoline_self_life_support {
Reproducible example code
// C++
#include <pybind11/pybind11.h>
class Foo {
public:
virtual ~Foo() = default;
};
// Trampoline class
class PyFoo : Foo, public py::trampoline_self_life_support {
public:
using Foo::Foo;
};
// Bindings
PYBIND11_MODULE("smart_holder", m) {
py::class_<Foo, PyFoo, PYBIND11_SH_DEF(Foo)>(m, "Foo")
.def(py::init<>())
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.