mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-05 14:11:43 +00:00
fix: expose required symbol using clang (#5700)
* test: Added test case for visibility of common symbols across shared libraries * style: pre-commit fixes * tests: cmake target name fix * tests: Added visibility test to ci * tests: set the default visibility to hidden * prototype/proof-of-concept fix: PYBIND11_EXPORT_GUARDED_DELETE * Fix silly oversight: actually use PYBIND11_EXPORT_GUARDED_DELETE * Update struct_smart_holder.h * style: pre-commit fixes * Update include/pybind11/detail/struct_smart_holder.h * Update struct_smart_holder.h * ci: fix addition to reusable-standard.yml * Update CMakeLists.txt * refactor: rename tests to test_cross_module_rtti Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com> Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
This commit is contained in:
20
tests/test_cross_module_rtti/bindings.cpp
Normal file
20
tests/test_cross_module_rtti/bindings.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
#include <lib.h>
|
||||
|
||||
class BaseTrampoline : public lib::Base, public pybind11::trampoline_self_life_support {
|
||||
public:
|
||||
using lib::Base::Base;
|
||||
int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get); }
|
||||
};
|
||||
|
||||
PYBIND11_MODULE(test_cross_module_rtti_bindings, m) {
|
||||
pybind11::classh<lib::Base, BaseTrampoline>(m, "Base")
|
||||
.def(pybind11::init<int, int>())
|
||||
.def_readwrite("a", &lib::Base::a)
|
||||
.def_readwrite("b", &lib::Base::b);
|
||||
|
||||
m.def("get_foo", [](int a, int b) -> std::shared_ptr<lib::Base> {
|
||||
return std::make_shared<lib::Foo>(a, b);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user