external_module.cpp
Go to the documentation of this file.
1 #include <pybind11/pybind11.h>
2 
3 namespace py = pybind11;
4 
5 /* Simple test module/test class to check that the referenced internals data of external pybind11
6  * modules aren't preserved over a finalize/initialize.
7  */
8 
9 PYBIND11_MODULE(external_module, m) {
10  class A {
11  public:
12  explicit A(int value) : v{value} {};
13  int v;
14  };
15 
16  py::class_<A>(m, "A").def(py::init<int>()).def_readwrite("value", &A::v);
17 
18  m.def("internals_at",
19  []() { return reinterpret_cast<uintptr_t>(&py::detail::get_internals()); });
20 }
Matrix3f m
PYBIND11_NOINLINE internals & get_internals()
Return a reference to the current internals data.
Definition: internals.h:405
Array< int, Dynamic, 1 > v
_W64 unsigned int uintptr_t
Definition: ms_stdint.h:124
PYBIND11_MODULE(external_module, m)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:13