Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /jana2/src/python/externals/pybind11-2.10.3/tests/test_embed/external_module.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #include <pybind11/pybind11.h>
0002 
0003 namespace py = pybind11;
0004 
0005 /* Simple test module/test class to check that the referenced internals data of external pybind11
0006  * modules aren't preserved over a finalize/initialize.
0007  */
0008 
0009 PYBIND11_MODULE(external_module, m) {
0010     class A {
0011     public:
0012         explicit A(int value) : v{value} {};
0013         int v;
0014     };
0015 
0016     py::class_<A>(m, "A").def(py::init<int>()).def_readwrite("value", &A::v);
0017 
0018     m.def("internals_at",
0019           []() { return reinterpret_cast<uintptr_t>(&py::detail::get_internals()); });
0020 }