Solved! - Please check the answer.
I wrote a library where headers and python bindings are auto-generated. For example dummy_bind.cpp for dummy_message.h and each _bind.cpp file has PYBIND11_MODULE call in it for their specific class. There are dozens of other _bind.cpp files for other headers. What should be the module name for each file when calling the PYBIND11_MODULE like:
PYBIND11_MODULE(protocol_name, m)
{
/// …
}
If I use protocol_name in each PYBIND11_MODULE(protocol_name, m) call, when compiling I get multiple definition error like: multiple definition of PyInit_protocol_name. If I generate special module name for each message like PYBIND11_MODULE(protocol_name_dummy, m) the extension is compiled but I think I need to import each module one by one which is not viable.
Should I do all exports inside a single PYBIND11_MODULE call? Thanks in advance.