Chris Colbert wrote: > using something similar to ctypes dlopen? > > I would like to be able to create a wrapper for a library that can > built on the client machine without the necessity of the target > libraries being present.
Consider having multiple modules -- say, mylib and mylib.withsolib. a) Have the build fail gracefully for withsolib b) In mylib, import withsolib with a try/except. This is by far the most cross-platform, robust etc. etc. way of doing it -- it basically pushes everything to the build system. > > Then, upon import of the library, the library would check for the > presence of the .so's and raise an exception if they are not found. > > This way, once the user installs the libraries, the functionality > automagically works. > > I've searched around, but not really found anything on the topic. > > Is it as easy as just using "cdef extern from dlfcn.h" and declaring > the appropriate dlopen machinery and using as normal? Yes, should be. That is, you need to declare function pointers and use the functions through these: cdef double (*cosine)(double) And then assign and call them. The example from "man dlopen" can probably be ported almost verbatim to Cython. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
