Prevent embedded modules from being loaded as a dependency? #5155
Unanswered
bruce-optibrium
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A while ago I posted a question in general - #5079 . I think that was possbily the wrong forum.
Basically the problem is I would like to be able to load a .dll into a python interpreter (which is a dependency of a compiled python module) without the dll initialisation failing because it happens to contain embedded module. It fails because that module tries to initialise itself when the dll is loaded, discovers there is already a python interpreter running (of course because it loaded the dll) and throws an exception. An exception thrown during dll initialisation cannot be caught and makes the load fail.
I am wondering if anyone else has come across this and has a good solution?
Is there something that can be done to allow the exception to be avoided perhaps by telling the embedded module it doesn't need to be loaded at all in this context and which would have a chance of being accepted into trunk?
I haven't had a chance to try this yet but perhaps something like:
embed.h
on linux you can override the weak symbol at link time with :
and on windows - https://learn.microsoft.com/en-us/cpp/build/reference/include-force-symbol-references?view=msvc-170:
Beta Was this translation helpful? Give feedback.
All reactions