Hello all > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:numpy- > [EMAIL PROTECTED] On Behalf Of David Cournapeau > Sent: 18 August 2006 06:55 > To: Discussion of Numerical Python > Subject: [Numpy-discussion] ctypes: how does load_library work ? > > <snip> > That works OK, but to avoid the platform dependency, I would like to use > load_library from numpy: I just replace the cdll.LoadLibrary by : > > _hello = N.ctypeslib.load_library('hello', '.') > > which does not work. The python interpreter returns a strange error > message, because it says hello.so.so is not found, and it is looking for > the library in the directory usr/$(PWD), which does not make sense to > me. Is it a bug, or am I just not understanding how to use the > load_library function ?
load_library currently assumes that library names don't have a prefix. We might want to rethink this assumption on Linux and other Unixes. load_library's second argument is a filename or a directory name. If it's a directory, load_library looks for hello.<platformspecificextension> in that directory. If it's a filename, load_library calls os.path.dirname to get a directory. The idea with this is that in a module you'll probably have one file that loads the library and sets up argtypes and restypes and here you'll do (in mylib.py): _mylib = numpy.ctypeslib.load_library('mylib_', __file__) and then the library will be installed in the same directory as mylib.py. Better suggestions for doing all this appreciated. ;-) Cheers, Albert ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion