libspeex.dll - CDLL returns no error but than python can not find function
===

I am using some wrapper over libspeex.dll

SPEEX.PY:

    from ctypes import *
    import sys
    
    speexDll = CDLL("c:/windows/system32/libspeex.dll")
    
    """
    
    Bla-bla-bla defines skipped
    
    """
    
    class SpeexBits(Structure):
        _fields_ = [('chars', c_char_p)
                    , ('nbBits', c_int)
                    , ('charPtr', c_int)
                    , ('bitPtr', c_int)
                    , ('owner', c_int)
                    , ('overflow', c_int)
                    , ('buf_size', c_int)
                    , ('reserved1', c_int)
                    , ('reserved2', c_void_p)
                    ]
    
    class Encoder:
        def initialize(self, mode=SPEEX_MODEID_UWB):
            self.state = speexDll.speex_encoder_init(speexDll.speex_lib_get_mode(mode))
    
            self.set(SPEEX_SET_VBR, 1)
            self.set(SPEEX_SET_QUALITY, 8 )
            self.set(SPEEX_SET_COMPLEXITY, 3)
            self.set(SPEEX_SET_HIGHPASS, 1)
    
            self.bits = SpeexBits()
            speexDll.speex_bits_init(byref(self.bits))
            self.buffer = create_string_buffer(2000)
    
        def encode(self, data):
            self.buffer.value = data
            speexDll.speex_bits_reset(byref(self.bits))
            speexDll.speex_encode_int(self.state, self.buffer, byref(self.bits))
            written = speexDll.speex_bits_write(byref(self.bits), self.buffer, len(self.buffer))
            return string_at(self.buffer, written)
    
        def destroy(self):
            speexDll.speex_encoder_destroy(self.state)
            speexDll.speex_bits_destroy(byref(self.bits))
    
        def getframesize(self):
            return self.get(SPEEX_GET_FRAME_SIZE)
    
        def set(self, request, val):
            if request in [SPEEX_SET_VBR, SPEEX_SET_QUALITY, SPEEX_SET_COMPLEXITY, SPEEX_SET_HIGHPASS]:
                tmp = c_int()
                tmp.value = val
                speexDll.speex_encoder_ctl(self.state, request, byref(tmp))
    
        def get(self, request):
            if request in [SPEEX_GET_FRAME_SIZE]:
                tmp = c_int()
                speexDll.speex_encoder_ctl(self.state, request, byref(tmp))
                return tmp.value
            else:
                return None
    
    class Decoder:
        def initialize(self, mode=SPEEX_MODEID_UWB):
            self.state = speexDll.speex_decoder_init(speexDll.speex_lib_get_mode(mode))
            self.bits = SpeexBits()
            speexDll.speex_bits_init(byref(self.bits))
            self.buffer = create_string_buffer(2000)
    
        def decode(self, data):
            self.buffer.value = data
            speexDll.speex_bits_read_from(byref(self.bits), self.buffer, len(data))
            speexDll.speex_decode_int(self.state, byref(self.bits), self.buffer)
            return string_at(self.buffer, 640)
    
        def destroy(self):
            speexDll.speex_decoder_destroy(self.state)
            speexDll.speex_bits_destroy(byref(self.bits))

When i use the code as following:

    import speex
    e = speex.Encoder()
    e.initialize(speex.SPEEX_MODEID_WB)

i got an error:
AttributeError: function 'speex_bits_init' not found.

I checked, this function is declared inside DLL.

What to do?
