Thanks for the implementation, can't wait to try. But again I'm running into
some problems. 

I installed the c stl with configure --prefix='/home/me/libcalg'

Changed the setup.py:

#!/usr/bin/env python
# python setup.py build_ext --inplace
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext = Extension(
    "cy_hash",
    ["cy_hash.pyx"],
    language="c",
    include_dirs=['/home/me/libcalg/include/libcalg-1.0'],
    library_dirs=['/home/me/libcalg/lib'],
    libraries=['calg'],                 #also tried 'libcalg/calg'
    cmdclass = {'build_ext': build_ext}
    )

setup(
    cmdclass={'build_ext': build_ext},
    ext_modules=[ext]
    )

When I run python setup.py build_ext --inplace

I get a warning: /usr/lib/python2.5/distutils/extension.py:133: UserWarning:
Unknown Extension options: 'cmdclass' 
warnings.warn(msg)

When I run python -c 'import cy_hash as cc; cc.test()'

I get: ImportError: libcalg.so.0: cannot open shared object file: No such
file or directory

The file is compiled and ready in '/home/me/libcalg/lib' and is rwx
accessible for me. What's going on here?



-----Original Message-----
From: Robert Bradshaw [mailto:[email protected]] 
Sent: maandag 7 september 2009 23:53
To: Cython-dev; Sebastien Binet
Cc: [email protected]
Subject: Re: [Cython] FW: cython and hash tables / dictionary

Thanks for the implementation. I noticed that your compare was only  
comparing pointers, so if you had two equal strings at different  
memory addresses it wouldn't find them (which may or may not be what  
you'd want) Also, your pointers would go out of scope as soon as test  
ended (so you couldn't return ht and use it later).

I built on what you had to get a float -> float hashtable. Note that  
this technique only works since the float value fits inside a void*,  
anything bigger and you'd have to allocate memory manually to stick  
it into the hashtable.

- Robert


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to