Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96756
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Subject | Re: python how to load multiple C libraries |
| References | <55F937D6.6040104@inhand.com.cn> <201509161313.t8GDDfUM017723@fido.openend.se> <55FA6EA6.1030405@inhand.com.cn> |
| Date | 2015-09-17 11:38 +0200 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.692.1442482952.8327.python-list@python.org> (permalink) |
In a message of Thu, 17 Sep 2015 15:41:26 +0800, "chenchao@inhand.com.cn" write
s:
> So, I checked my ctypes source code, I found RTLD_LAZY defined in
>dlfcn.h header file like this:
>/* The MODE argument to `dlopen' contains one of the following: */
>#define RTLD_LAZY 0x00001 /* Lazy function call binding. */
>#define RTLD_NOW 0x00002 /* Immediate function call binding. */
>#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
>#define RTLD_NOLOAD 0x00004 /* Do not load the object. */
>#if 0 /* uClibc doesnt support these */
>#define RTLD_DEEPBIND 0x00008 /* Use deep binding. */
>#endif
>
>/* If the following bit is set in the MODE argument to `dlopen',
> the symbols of the loaded object and its dependencies are made
> visible as if the object were linked directly into the program. */
>#define RTLD_GLOBAL 0x00100
>
>/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
> The implementation does this by default and so we can define the
> value to zero. */
>#define RTLD_LOCAL 0
>
>/* Do not delete object when closed. */
>#define RTLD_NODELETE 0x01000
>The first of all, I have added followed codes in function:
>PyMODINIT_FUNC init_ctypes(void) {...} in _ctypes.c file.
>
> /* add RTLD_LAZY and RTLD_NOW definitions*/
> PyModule_AddObject(m, "RTLD_LAZY", PyInt_FromLong(RTLD_LAZY));
> PyModule_AddObject(m, "RTLD_NOW", PyInt_FromLong(RTLD_NOW));
>
>So, Is there anybody know how the CDLL can accept mode flag:RTLD_LAZY?
It's a known open bug.
https://bugs.python.org/issue20276
Some people who have really needed to get this to work with ctypes have
modified the source for ctypes as discribed here:
http://osdir.com/ml/python.ctypes/2006-10/msg00029.html
I just stopped using ctypes and use cffi instead.
https://cffi.readthedocs.org/en/latest/
Laura
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: python how to load multiple C libraries Laura Creighton <lac@openend.se> - 2015-09-17 11:38 +0200
csiph-web