-
I am embedding Python in an application and I would like to statically link against a Pybind11 module so that it is available without having to use I think I have to add a line in In #466 @wjakob mentions that:
But I think that is not entirely true, unless it is a limitation of Pybind11, right? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I have tried adding the following line to my
I set the identifier of the module like this since Python links against the symbol I confirmed that the symbol requested by Python exists in the libMODULE.a (statically linked Pybind11 module) but it seems to not be getting included. I am currently trying to bring in the whole archive by manipulating the linker flags as specified in tweaking compiler linker flags. I am currently trying with the following line but it still isn't quite working:
Using
while libMODULE.a contains:
So it seems like it is just a question of getting that symbol from A to B... |
Beta Was this translation helpful? Give feedback.
Ok, I overlooked that the module I was trying to build actually contains a mixture of Python code and C++ code. Hence the issue was that I had
MODULE
(Python code) and_MODULE_pybind11
(C++ code). The code of the C++ module itself defined the name_MODULE_pybind11
and it is used internally byMODULE
.I am still trying to patch everything up and get stuff working, but in summary, it seems that it is pretty straight forward to statically link a Pybind11 library to the Python interpreter.