Closed mrzv closed 8 years ago
Can't you import the base library using module::import
and initialize the parent class_
via module::attr
or so?
Oh, interesting. That didn't occur to me. I'm going to try it now.
Brilliant! It works.
A tangentially related bug. Calling py::module::import
on a non-existent module (or the one not in your path) from PYBIND11_PLUGIN(...)
results in a segfault. Probably an exception should be thrown.
I committed a patch with proper error handling at module import time. Closing this ticket.
Suppose I'm writing a library that has some new widgets, maybe some new screens in it. I can expose those to Python using pybind11 without a problem, but I cannot find a way to express that they derive from the respective nanogui classes. It seems the solution would be to expose instances like
widget
as thestatic
variables ofnanogui.so
(and define them for all the classes). It would probably mean that the new libraries would have to link against thenanogui.so
, which is not ideal, but not a deal-breaker either.I hope it makes sense what I'm after.