Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96676 > unrolled thread

Re: python how to load multiple C libraries

Started byLaura Creighton <lac@openend.se>
First post2015-09-16 15:13 +0200
Last post2015-09-16 15:13 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: python how to load multiple C libraries Laura Creighton <lac@openend.se> - 2015-09-16 15:13 +0200

#96676 — Re: python how to load multiple C libraries

FromLaura Creighton <lac@openend.se>
Date2015-09-16 15:13 +0200
SubjectRe: python how to load multiple C libraries
Message-ID<mailman.634.1442409253.8327.python-list@python.org>
In a message of Wed, 16 Sep 2015 17:35:18 +0800, "chenchao@inhand.com.cn" write
s:
>hi:
>I encountered a problem. I use ctypes load multiple C  libraries, but 
>the libraries have dependence each other.So, how can i load these 
>libraries. For example, I have two libraries:A、B, but A depends on B, B 
>depends on A. So how do I load them? Is there anybody know how to do it?

I don't know how to do this with ctypes (which doesn't mean it cannot be
done, just that I haven't ever wanted to do this). What happens if you
make a small file that loads both separately and loads that one first?

It may be that you can get what you want with by loading the first lib
RTLD_LAZY instead of RTLD_NOW.  see:
http://stackoverflow.com/questions/22591472/dyanamic-library-linking-by-rtld-lazy
see: this very old thread, maybe CTypes knows about it now.
http://osdir.com/ml/python.ctypes/2006-10/msg00029.html

But I have never tried.

These days I used cffi instead of ctypes.

If you use cffi https://pypi.python.org/pypi/cffi
there should not be any problem if you use ffi.set_source(), 
only once, but mentioning both libs in the libraries=[...] argument.

Laura


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web