Q: I get this error message when compiling a large source file. What can I do?
A: You have two choices:
my_module.cpp
:
... void more_of_my_module(); BOOST_PYTHON_MODULE(my_module) { def("foo", foo); def("bar", bar); ... more_of_my_module(); }
more_of_my_module.cpp
:
void more_of_my_module() { def("baz", baz); ... }
If you find that a class_<...>
declaration can't fit in
a single source file without triggering the error, you can always pass
a reference to the class_
object to a function in another source file, and call some of its member
functions (e.g. .def(...)
) in the auxilliary source file:
more_of_my_class.cpp
:
void more_of_my_class(class<my_class>& x) { x .def("baz", baz) .add_property("xx", &my_class::get_xx, &my_class::set_xx) ; ... }