pybind11/docs/advanced
Jason Rhinelander 5e14aa6aa7 Allow module-local classes to be loaded externally
The main point of `py::module_local` is to make the C++ -> Python cast
unique so that returning/casting a C++ instance is well-defined.
Unfortunately it also makes loading unique, but this isn't particularly
desirable: when an instance contains `Type` instance there's no reason
it shouldn't be possible to pass that instance to a bound function
taking a `Type` parameter, even if that function is in another module.

This commit solves the issue by allowing foreign module (and global)
type loaders have a chance to load the value if the local module loader
fails.  The implementation here does this by storing a module-local
loading function in a capsule in the python type, which we can then call
if the local (and possibly global, if the local type is masking a global
type) version doesn't work.
2017-08-19 15:30:39 -04:00
..
cast Add support for boost::variant in C++11 mode 2017-08-12 21:27:44 +02:00
pycpp Split test_python_types.cpp into builtin_casters, stl and pytypes 2017-06-27 10:38:41 +02:00
classes.rst Allow module-local classes to be loaded externally 2017-08-19 15:30:39 -04:00
embedding.rst Add py::module_local() attribute for module-local type bindings 2017-08-04 10:47:34 -04:00
exceptions.rst Reorganize documentation 2016-10-20 15:21:34 +02:00
functions.rst Fix exception reference error 2017-05-26 23:20:48 -04:00
misc.rst Compile with hidden visibility always; set via cmake property rather than compiler flag 2017-08-14 11:44:17 -04:00
smart_ptrs.rst Replace PYBIND11_PLUGIN with PYBIND11_MODULE 2017-05-29 03:21:19 +02:00