Merge branch 'main' of github.com:Rconybea/xo-pyreflect

This commit is contained in:
Roland Conybeare 2024-06-19 11:00:25 -04:00
commit 92c4cda97f
4 changed files with 37 additions and 9 deletions

View file

@ -3,6 +3,8 @@
set(SELF_LIB xo_pyreflect)
set(SELF_SRCS pyreflect.cpp)
# ----------------------------------------------------------------
xo_pybind11_library(${SELF_LIB} ${PROJECT_NAME}Targets ${SELF_SRCS})
xo_pybind11_dependency(${SELF_LIB} reflect)
xo_pybind11_dependency(${SELF_LIB} xo_pyutil)

View file

@ -37,6 +37,12 @@ namespace xo {
//py::class_<utc_nanos>(m, "utc_nanos");
//py::class_<TypeDescrImpl>(m, "TypeDescr");
/* TypeDescrBase instances are created automatically at library load time
* by static initializers. The reflection library (xo-reflect) is responsible
* for lifetime of TypeDescrobjects. Under no circumstances should python
* (or pybind11) directly destroy a TypeDescrImpl instance, hence use of
* unowned_ptr<TypeDescrBase> here.
*/
py::class_<TypeDescrBase,
unowned_ptr<TypeDescrBase>>(m, "TypeDescr")