Boost.Python - registration for multiple modules only works with dynamic linking?
Hi! I've stumbled upon `TypeError: No to_python (by-value) converter found for C++ type: class MyClass` kind of error and trying to debug it I came to the conclusion in the thread subject and wanted to verify if I'm not missing something, since I'm not very familar with Boost. So let's say there is `libA` that defines `MyClass` and there's a `libB` that's using it (e.g.. it has `MyClass produce_my_class()`). If `libA` and `libB` are statically linked against Boost.Python, then using `libB` method fails to find a converter (code snippet is below). If I link `libA` and `libB` against shared Boost.Python library, then the issue is resolved. I assume registration is kind of happen *per-Boost.Python-static-instance*, not *per-process*? What's the common practice for this? E.g. let's say there's an independant math library `Math` and it's using Boost.Python. For it to be distributable it typically would statically link Boost.Python. Then there's another library `Geometry` that's trying to use `Math` using Boost.Python bindings. Then the only way it would be able find the converters, if it redefines them? ```python import libA print(libA.MyClass(25)) # <libA.MyClass object at 0x00000199048BC270> import libB print(libB.produce_my_class(25)) # Traceback (most recent call last): # File "<string>", line 1, in <module> # TypeError: No to_python (by-value) converter found for C++ type: class MyClass ```
participants (1)
-
Andrej