Description
Currently, I believe the wrapper will break if you open, close, then reopen a namespace. For example:
namespace ns {
int a = 5;
}
namespace ns {
int b = 6;
}
Since the wrapper is not smart enough to realize that these are the same and hence it doesn't have to redefine the submodule pybind11::module m_ns = ...
.
Aside from minor inconveniences of writing a .i
file to remember to put all the stuff from a namespace at the same place, this causes issues using combine_interface_headers
which just copy-pastes the contents together. Thus if you want to "add" to a namespace from a different interface header, it won't work.
Not sure whether or not the goal of having a nice pybind way to #include other .i
files would be able to handle this, or if we just need some intelligent way of keeping track which namespaces have been handled. For example, a 2-pass approach: first go through all the namespaces and just define them and keep a set()
of defined namespaces, then second pass do all the "real" wrapping.