Stefan van der Walt wrote:
> On Fri, Aug 18, 2006 at 01:54:44PM +0900, David Cournapeau wrote:
>
>> import numpy as N
>> from ctypes import cdll, POINTER, c_int, c_uint
>>
>> _hello = cdll.LoadLibrary('libhello.so')
>>
>> _hello.sum.restype = c_int
>> _hello.sum.artype = [POINTER(c_int), c_uint]
>>
>> def sum(data):
>> return _hello.sum(data.ctypes.data_as(POINTER(c_int)), len(data))
>>
>> n = 10
>> data = N.arange(n)
>>
>> print data
>> print "sum(data) is " + str(sum(data))
>>
>>
>> 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', '.')
>>
>
> Shouldn't that be 'libhello'? Try
>
> _hello = N.ctypes_load_library('libhello','__file__')
>
Well, the library name convention under unix, as far as I know, is
'lib'+ name + '.so' + 'version'. And if I put lib in front of hello, it
then does not work under windows.
David
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/numpy-discussion