Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59403
| From | Ned Deily <nad@acm.org> |
|---|---|
| Subject | Re: How to disable RTLD_NOW for Python 2.7.x dlopen() in Mac OS X Mavericks? |
| Date | 2013-11-13 19:44 -0800 |
| References | <c9bc3283-e895-4d9f-a749-fc35497a875e@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2581.1384400696.18130.python-list@python.org> (permalink) |
In article <c9bc3283-e895-4d9f-a749-fc35497a875e@googlegroups.com>, tcwan99@gmail.com wrote: > I'm facing a problem with a 3rd party C/C++ Framework (dynamic library) on > Mac OS X which I'm trying to import into Python using ctypes. Unfortunately > OS X has deprecated a function which is called from the Framework and is no > longer available as of 10.8+ (Mtn. Lion, now updated to Mavericks). In > addition, there is no recent version of the 3rd party framework available and > it does not look like it's actively updated. (The 3rd party framework in > question is the Fantom framework/driver for the LEGO Mindstorms NXT/EV3). > > Existing tools using the 3rd party framework runs ok, but attempting to > access it using ctypes fails with a Symbol not Found error when Python 2.7.x > attempts to dlopen() the library. I suspect it is due to the setting of > RTLD_NOW when opening the framework. I'd like to try to specify RTLD_LAZY > instead. > > Unfortunately sys.setdlopenflags(0) does not appear to do anything. RTLD_NOW > is still set, which I presume overrides RTLD_LAZY if both flags were set. > I've tried this with both the Apple supplied python and the version from > MacPorts. > > Enclosed is a snippet of the code and the Traceback. Is there a way to force > RTLD_NOW off? I'm not very familiar with ctypes internals but it looks like sys.setdlopenflags is not intended to have an influence on ctypes; rather, it conditions the Python interpreter's use of dlopen to load shared Python modules. For ctypes itself, it looks like it unconditionally sets RTLD_NOW when calling dlopen and probably with good reason: http://hg.python.org/cpython/file/2.7/Modules/_ctypes/callproc.c#l1432 Sorry, I don't have a suggestion for you, assuming you want to just try to ignore the error, other than perhaps running an older version of OS X in a VM on 10.8. -- Ned Deily, nad@acm.org
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to disable RTLD_NOW for Python 2.7.x dlopen() in Mac OS X Mavericks? tcwan99@gmail.com - 2013-11-13 17:08 -0800
Re: How to disable RTLD_NOW for Python 2.7.x dlopen() in Mac OS X Mavericks? Ned Deily <nad@acm.org> - 2013-11-13 19:44 -0800
Re: How to disable RTLD_NOW for Python 2.7.x dlopen() in Mac OS X Mavericks? Tat-Chee Wan <tcwan99@gmail.com> - 2013-11-14 18:30 -0800
csiph-web