From: SourceForge.net <no...@so...> - 2009-02-20 17:38:26
|
Bugs item #2620664, was opened at 2009-02-20 17:38 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2620664&group_id=1645 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Andy Buckley (andybuckley) Assigned to: Nobody/Anonymous (nobody) Summary: Need a way to prepend dlopen config to generated Python file Initial Comment: If making a Python wrapper for a C/C++ library which uses dlopen to implement a plugin system, it may be necessary to change the Python dlopen flags before doing anything else. For example, if the uses of dlopen require that symbols from each dlopening be visible to other dlopened libraries (not ideal, but this is the real world), then something like this needs to be prepended to the generated foo.py file: ## Change dlopen status to GLOBAL try: import ctypes sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL) except: import dl sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) At the moment I don't think this can be done in SWIG, so one either has to resort to a post-processing prepend to the generated Python module, or to putting this code at the head of any code which uses the module, before the module import itself. Neither is optimal: can a directive be added to make this possible from within SWIG --- %pythonhead or similar, perhaps? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101645&aid=2620664&group_id=1645 |