How to bind a Singleton across libraries? #5002
Unanswered
jordanlevy96
asked this question in
Q&A
Replies: 1 comment
-
I added similar question: In my case, the singleton works functionally but it is not behaving like a nice Python object (I can't define functions for it) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wrote up a detailed StackOverflow post: https://stackoverflow.com/questions/77764718/how-to-bind-a-singleton-to-python-in-pybind-across-libraries
Also a repo with minimal reproduction: https://github.com/jordanlevy96/pybind-singleton
TLDR: How to Singleton with pybind?
I've tried binding a simple Singleton class a few different ways:
But Python is always creating a new instance of the Singleton. It may have something to do with my build process; I have shared libraries set up in CMake:
Beta Was this translation helpful? Give feedback.
All reactions