[Speex-dev] GCC/ELF Visibility patch (fwd)

Thorvald Natvig speex at natvig.com
Fri Mar 28 20:09:49 PDT 2008


Hi,

I've attached a patch against SVN r14645 which adds GCC visibility information 
to all symbols exported from libspeex.so and libspeexdsp.so. It includes a 
configure.ac change to test that both the compiler flags and 
__attribute__((visibility)) works, and if so will
#define EXPORT __attribute__((visibility("default")))
and if not
#define EXPORT

I've attached a diff output of "nm -C -D" for both libraries (compiled on 
x86_64 Linux), and verified that none of the symbols removed are mentioned in 
any header file under include/

If this gets accepted, I'll make a similar effort for Win32 (where it hopefully 
should suffice to #define EXPORT in the config.h)
-------------- next part --------------
Index: configure.ac
===================================================================
--- configure.ac	(revision 14645)
+++ configure.ac	(working copy)
@@ -72,7 +72,28 @@
 )
 AC_MSG_RESULT($has_alloca)
 
+SAVE_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -fvisibility=hidden"
+AC_MSG_CHECKING(for ELF visibility)
+AC_COMPILE_IFELSE([
+AC_LANG_PROGRAM([[
+#pragma GCC visibility push(hidden)
+__attribute__((visibility("default")))
+int var=10;
+]])],
+[
+has_visibility=yes
+AC_DEFINE([EXPORT], [__attribute__((visibility("default")))], [Symbol visibility prefix])
+],
+[
+has_visibility=no
+AC_DEFINE([EXPORT], [], [Symbol visibility prefix])
+CFLAGS="$SAVE_CFLAGS"
+]
+)
+AC_MSG_RESULT($has_visibility)
 
+
 AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h)
 
 XIPH_PATH_OGG([src="src"], [src=""])
Index: libspeex/modes_wb.c
===================================================================
--- libspeex/modes_wb.c	(revision 14645)
+++ libspeex/modes_wb.c	(working copy)
@@ -52,7 +52,7 @@
 #define NULL 0
 #endif
 
-const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
+EXPORT const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
 
 extern const signed char hexc_table[];
 extern const signed char hexc_10_32_table[];
@@ -200,7 +200,7 @@
 };
 
 
-const SpeexMode speex_wb_mode = {
+EXPORT const SpeexMode speex_wb_mode = {
    &sb_wb_mode,
    wb_mode_query,
    "wideband (sub-band CELP)",
@@ -270,7 +270,7 @@
 }
 
 
-const SpeexMode speex_uwb_mode = {
+EXPORT const SpeexMode speex_uwb_mode = {
    &sb_uwb_mode,
    wb_mode_query,
    "ultra-wideband (sub-band CELP)",
@@ -289,7 +289,7 @@
 /* We have defined speex_lib_get_mode() as a macro in speex.h */
 #undef speex_lib_get_mode
 
-const SpeexMode * speex_lib_get_mode (int mode)
+EXPORT const SpeexMode * speex_lib_get_mode (int mode)
 {
    if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
 
Index: libspeex/bits.c
===================================================================
--- libspeex/bits.c	(revision 14645)
+++ libspeex/bits.c	(working copy)
@@ -45,7 +45,7 @@
 #define MAX_CHARS_PER_FRAME (2000/BYTES_PER_CHAR)
 #endif
 
-void speex_bits_init(SpeexBits *bits)
+EXPORT void speex_bits_init(SpeexBits *bits)
 {
    bits->chars = (char*)speex_alloc(MAX_CHARS_PER_FRAME);
    if (!bits->chars)
@@ -58,7 +58,7 @@
    speex_bits_reset(bits);
 }
 
-void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
+EXPORT void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
 {
    bits->chars = (char*)buff;
    bits->buf_size = buf_size;
@@ -68,7 +68,7 @@
    speex_bits_reset(bits);
 }
 
-void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
+EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
 {
    bits->chars = (char*)buff;
    bits->buf_size = buf_size;
@@ -82,14 +82,14 @@
    
 }
 
-void speex_bits_destroy(SpeexBits *bits)
+EXPORT void speex_bits_destroy(SpeexBits *bits)
 {
    if (bits->owner)
       speex_free(bits->chars);
    /* Will do something once the allocation is dynamic */
 }
 
-void speex_bits_reset(SpeexBits *bits)
+EXPORT void speex_bits_reset(SpeexBits *bits)
 {
    /* We only need to clear the first byte now */
    bits->chars[0]=0;
@@ -99,14 +99,14 @@
    bits->overflow=0;
 }
 
-void speex_bits_rewind(SpeexBits *bits)
+EXPORT void speex_bits_rewind(SpeexBits *bits)
 {
    bits->charPtr=0;
    bits->bitPtr=0;
    bits->overflow=0;
 }
 
-void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
+EXPORT void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
 {
    int i;
    int nchars = len / BYTES_PER_CHAR;
@@ -153,7 +153,7 @@
    bits->charPtr=0;
 }
 
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
+EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
 {
    int i,pos;
    int nchars = nbytes/BYTES_PER_CHAR;
@@ -185,7 +185,7 @@
    bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
 }
 
-int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
+EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
 {
    int i;
    int max_nchars = max_nbytes/BYTES_PER_CHAR;
@@ -208,7 +208,7 @@
    return max_nchars*BYTES_PER_CHAR;
 }
 
-int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
+EXPORT int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
 {
    int max_nchars = max_nbytes/BYTES_PER_CHAR;
    int i;
@@ -226,7 +226,7 @@
    return max_nchars*BYTES_PER_CHAR;
 }
 
-void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
+EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
 {
    unsigned int d=data;
 
@@ -269,7 +269,7 @@
    }
 }
 
-int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
+EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
 {
    unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
    /* If number is negative */
@@ -280,7 +280,7 @@
    return d;
 }
 
-unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
+EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
 {
    unsigned int d=0;
    if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
@@ -302,7 +302,7 @@
    return d;
 }
 
-unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
+EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
 {
    unsigned int d=0;
    int bitPtr, charPtr;
@@ -331,7 +331,7 @@
    return d;
 }
 
-int speex_bits_peek(SpeexBits *bits)
+EXPORT int speex_bits_peek(SpeexBits *bits)
 {
    if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits)
       bits->overflow=1;
@@ -340,7 +340,7 @@
    return (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
 }
 
-void speex_bits_advance(SpeexBits *bits, int n)
+EXPORT void speex_bits_advance(SpeexBits *bits, int n)
 {
     if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
       bits->overflow=1;
@@ -350,7 +350,7 @@
    bits->bitPtr = (bits->bitPtr+n) & (BITS_PER_CHAR-1);       /* modulo by BITS_PER_CHAR */
 }
 
-int speex_bits_remaining(SpeexBits *bits)
+EXPORT int speex_bits_remaining(SpeexBits *bits)
 {
    if (bits->overflow)
       return -1;
@@ -358,12 +358,12 @@
       return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr);
 }
 
-int speex_bits_nbytes(SpeexBits *bits)
+EXPORT int speex_bits_nbytes(SpeexBits *bits)
 {
    return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
 }
 
-void speex_bits_insert_terminator(SpeexBits *bits)
+EXPORT void speex_bits_insert_terminator(SpeexBits *bits)
 {
    if (bits->bitPtr)
       speex_bits_pack(bits, 0, 1);
Index: libspeex/mdf.c
===================================================================
--- libspeex/mdf.c	(revision 14645)
+++ libspeex/mdf.c	(working copy)
@@ -378,7 +378,7 @@
 #endif
 
 /** Creates a new echo canceller state */
-SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length)
+EXPORT SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length)
 {
    int i,N,M;
    SpeexEchoState *st = (SpeexEchoState *)speex_alloc(sizeof(SpeexEchoState));
@@ -495,7 +495,7 @@
 }
 
 /** Resets echo canceller state */
-void speex_echo_state_reset(SpeexEchoState *st)
+EXPORT void speex_echo_state_reset(SpeexEchoState *st)
 {
    int i, M, N;
    st->cancel_count=0;
@@ -545,7 +545,7 @@
 }
 
 /** Destroys an echo canceller state */
-void speex_echo_state_destroy(SpeexEchoState *st)
+EXPORT void speex_echo_state_destroy(SpeexEchoState *st)
 {
    spx_fft_destroy(st->fft_table);
 
@@ -587,7 +587,7 @@
 #endif
 }
 
-void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out)
+EXPORT void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out)
 {
    int i;
    /*speex_warning_int("capture with fill level ", st->play_buf_pos/st->frame_size);*/
@@ -610,7 +610,7 @@
    }
 }
 
-void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play)
+EXPORT void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play)
 {
    /*speex_warning_int("playback with fill level ", st->play_buf_pos/st->frame_size);*/
    if (!st->play_buf_started)
@@ -637,13 +637,13 @@
 }
 
 /** Performs echo cancellation on a frame (deprecated, last arg now ignored) */
-void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out, spx_int32_t *Yout)
+EXPORT void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out, spx_int32_t *Yout)
 {
    speex_echo_cancellation(st, in, far_end, out);
 }
 
 /** Performs echo cancellation on a frame */
-void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out)
+EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, const spx_int16_t *far_end, spx_int16_t *out)
 {
    int i,j;
    int N,M;
@@ -1141,7 +1141,7 @@
    
 }
 
-int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
+EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
 {
    switch(request)
    {
Index: libspeex/speex.c
===================================================================
--- libspeex/speex.c	(revision 14645)
+++ libspeex/speex.c	(working copy)
@@ -48,22 +48,22 @@
 
 
 
-void *speex_encoder_init(const SpeexMode *mode)
+EXPORT void *speex_encoder_init(const SpeexMode *mode)
 {
    return mode->enc_init(mode);
 }
 
-void *speex_decoder_init(const SpeexMode *mode)
+EXPORT void *speex_decoder_init(const SpeexMode *mode)
 {
    return mode->dec_init(mode);
 }
 
-void speex_encoder_destroy(void *state)
+EXPORT void speex_encoder_destroy(void *state)
 {
    (*((SpeexMode**)state))->enc_destroy(state);
 }
 
-void speex_decoder_destroy(void *state)
+EXPORT void speex_decoder_destroy(void *state)
 {
    (*((SpeexMode**)state))->dec_destroy(state);
 }
@@ -85,7 +85,7 @@
 #ifdef FIXED_POINT
 
 #ifndef DISABLE_FLOAT_API
-int speex_encode(void *state, float *in, SpeexBits *bits)
+EXPORT int speex_encode(void *state, float *in, SpeexBits *bits)
 {
    int i;
    spx_int32_t N;
@@ -104,7 +104,7 @@
 }
 #endif /* #ifndef DISABLE_FLOAT_API */
 
-int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
+EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
 {
    SpeexMode *mode;
    mode = *(SpeexMode**)state;
@@ -112,7 +112,7 @@
 }
 
 #ifndef DISABLE_FLOAT_API
-int speex_decode(void *state, SpeexBits *bits, float *out)
+EXPORT int speex_decode(void *state, SpeexBits *bits, float *out)
 {
    int i, ret;
    spx_int32_t N;
@@ -125,7 +125,7 @@
 }
 #endif /* #ifndef DISABLE_FLOAT_API */
 
-int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
+EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
 {
    SpeexMode *mode = *(SpeexMode**)state;
    return (mode)->dec(state, bits, out);
@@ -133,12 +133,12 @@
 
 #else
 
-int speex_encode(void *state, float *in, SpeexBits *bits)
+EXPORT int speex_encode(void *state, float *in, SpeexBits *bits)
 {
    return (*((SpeexMode**)state))->enc(state, in, bits);
 }
 
-int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
+EXPORT int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
 {
    int i;
    spx_int32_t N;
@@ -149,12 +149,12 @@
    return (*((SpeexMode**)state))->enc(state, float_in, bits);
 }
 
-int speex_decode(void *state, SpeexBits *bits, float *out)
+EXPORT int speex_decode(void *state, SpeexBits *bits, float *out)
 {
    return (*((SpeexMode**)state))->dec(state, bits, out);
 }
 
-int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
+EXPORT int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
 {
    int i;
    spx_int32_t N;
@@ -177,12 +177,12 @@
 
 
 
-int speex_encoder_ctl(void *state, int request, void *ptr)
+EXPORT int speex_encoder_ctl(void *state, int request, void *ptr)
 {
    return (*((SpeexMode**)state))->enc_ctl(state, request, ptr);
 }
 
-int speex_decoder_ctl(void *state, int request, void *ptr)
+EXPORT int speex_decoder_ctl(void *state, int request, void *ptr)
 {
    return (*((SpeexMode**)state))->dec_ctl(state, request, ptr);
 }
@@ -215,7 +215,7 @@
 
 
 
-int speex_lib_ctl(int request, void *ptr)
+EXPORT int speex_lib_ctl(int request, void *ptr)
 {
    switch (request)
    {
Index: libspeex/modes.c
===================================================================
--- libspeex/modes.c	(revision 14645)
+++ libspeex/modes.c	(working copy)
@@ -337,7 +337,7 @@
 
 
 /* Default mode for narrowband */
-const SpeexMode speex_nb_mode = {
+EXPORT const SpeexMode speex_nb_mode = {
    &nb_mode,
    nb_mode_query,
    "narrowband",
@@ -355,7 +355,7 @@
 
 
 
-int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
+EXPORT int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
 {
    return mode->query(mode->mode, request, ptr);
 }
Index: libspeex/resample.c
===================================================================
--- libspeex/resample.c	(revision 14645)
+++ libspeex/resample.c	(working copy)
@@ -721,12 +721,12 @@
 
 }
 
-SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
+EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
 {
    return speex_resampler_init_frac(nb_channels, in_rate, out_rate, in_rate, out_rate, quality, err);
 }
 
-SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
+EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
 {
    spx_uint32_t i;
    SpeexResamplerState *st;
@@ -779,7 +779,7 @@
    return st;
 }
 
-void speex_resampler_destroy(SpeexResamplerState *st)
+EXPORT void speex_resampler_destroy(SpeexResamplerState *st)
 {
    speex_free(st->mem);
    speex_free(st->sinc_table);
@@ -854,7 +854,7 @@
 #define FIXED_STACK_ALLOC 1024
 
 #ifdef FIXED_POINT
-int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
 {
    spx_uint32_t i;
    int istride_save, ostride_save;
@@ -920,16 +920,16 @@
 #endif
    return RESAMPLER_ERR_SUCCESS;
 }
-int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
 {
    return speex_resampler_process_native(st, channel_index, in, in_len, out, out_len);
 }
 #else
-int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
 {
    return speex_resampler_process_native(st, channel_index, in, in_len, out, out_len);
 }
-int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
 {
    spx_uint32_t i;
    int istride_save, ostride_save;
@@ -997,7 +997,7 @@
 }
 #endif
 
-int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
 {
    spx_uint32_t i;
    int istride_save, ostride_save;
@@ -1019,7 +1019,7 @@
 }
 
                
-int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
+EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
 {
    spx_uint32_t i;
    int istride_save, ostride_save;
@@ -1040,18 +1040,18 @@
    return RESAMPLER_ERR_SUCCESS;
 }
 
-int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
+EXPORT int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
 {
    return speex_resampler_set_rate_frac(st, in_rate, out_rate, in_rate, out_rate);
 }
 
-void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
+EXPORT void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
 {
    *in_rate = st->in_rate;
    *out_rate = st->out_rate;
 }
 
-int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
+EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
 {
    spx_uint32_t fact;
    spx_uint32_t old_den;
@@ -1090,13 +1090,13 @@
    return RESAMPLER_ERR_SUCCESS;
 }
 
-void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
+EXPORT void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
 {
    *ratio_num = st->num_rate;
    *ratio_den = st->den_rate;
 }
 
-int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
+EXPORT int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
 {
    if (quality > 10 || quality < 0)
       return RESAMPLER_ERR_INVALID_ARG;
@@ -1108,42 +1108,42 @@
    return RESAMPLER_ERR_SUCCESS;
 }
 
-void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
+EXPORT void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
 {
    *quality = st->quality;
 }
 
-void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
+EXPORT void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
 {
    st->in_stride = stride;
 }
 
-void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
+EXPORT void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
 {
    *stride = st->in_stride;
 }
 
-void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
+EXPORT void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
 {
    st->out_stride = stride;
 }
 
-void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
+EXPORT void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
 {
    *stride = st->out_stride;
 }
 
-int speex_resampler_get_input_latency(SpeexResamplerState *st)
+EXPORT int speex_resampler_get_input_latency(SpeexResamplerState *st)
 {
   return st->filt_len / 2;
 }
 
-int speex_resampler_get_output_latency(SpeexResamplerState *st)
+EXPORT int speex_resampler_get_output_latency(SpeexResamplerState *st)
 {
   return ((st->filt_len / 2) * st->den_rate + (st->num_rate >> 1)) / st->num_rate;
 }
 
-int speex_resampler_skip_zeros(SpeexResamplerState *st)
+EXPORT int speex_resampler_skip_zeros(SpeexResamplerState *st)
 {
    spx_uint32_t i;
    for (i=0;i<st->nb_channels;i++)
@@ -1151,7 +1151,7 @@
    return RESAMPLER_ERR_SUCCESS;
 }
 
-int speex_resampler_reset_mem(SpeexResamplerState *st)
+EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st)
 {
    spx_uint32_t i;
    for (i=0;i<st->nb_channels*(st->filt_len-1);i++)
@@ -1159,7 +1159,7 @@
    return RESAMPLER_ERR_SUCCESS;
 }
 
-const char *speex_resampler_strerror(int err)
+EXPORT const char *speex_resampler_strerror(int err)
 {
    switch (err)
    {
Index: libspeex/stereo.c
===================================================================
--- libspeex/stereo.c	(revision 14645)
+++ libspeex/stereo.c	(working copy)
@@ -72,14 +72,14 @@
 #define COMPATIBILITY_HACK(s) 
 #endif
 
-SpeexStereoState *speex_stereo_state_init()
+EXPORT SpeexStereoState *speex_stereo_state_init()
 {
    SpeexStereoState *stereo = speex_alloc(sizeof(SpeexStereoState));
    speex_stereo_state_reset(stereo);
    return stereo;
 }
 
-void speex_stereo_state_reset(SpeexStereoState *_stereo)
+EXPORT void speex_stereo_state_reset(SpeexStereoState *_stereo)
 {
    RealSpeexStereoState *stereo = (RealSpeexStereoState*)_stereo;
 #ifdef FIXED_POINT
@@ -99,13 +99,13 @@
 #endif   
 }
 
-void speex_stereo_state_destroy(SpeexStereoState *stereo)
+EXPORT void speex_stereo_state_destroy(SpeexStereoState *stereo)
 {
    speex_free(stereo);
 }
 
 #ifndef DISABLE_FLOAT_API
-void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
+EXPORT void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
 {
    int i, tmp;
    float e_left=0, e_right=0, e_tot=0;
@@ -143,7 +143,7 @@
 }
 #endif /* #ifndef DISABLE_FLOAT_API */
 
-void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
+EXPORT void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits)
 {
    int i, tmp;
    spx_word32_t e_left=0, e_right=0, e_tot=0;
@@ -218,7 +218,7 @@
 }
 
 #ifndef DISABLE_FLOAT_API
-void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_stereo)
+EXPORT void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *_stereo)
 {
    int i;
    spx_word32_t balance;
@@ -245,7 +245,7 @@
 }
 #endif /* #ifndef DISABLE_FLOAT_API */
 
-void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *_stereo)
+EXPORT void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *_stereo)
 {
    int i;
    spx_word32_t balance;
@@ -271,7 +271,7 @@
    }
 }
 
-int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
 {
    RealSpeexStereoState *stereo;
    spx_word16_t sign=1, dexp;
Index: libspeex/jitter.c
===================================================================
--- libspeex/jitter.c	(revision 14645)
+++ libspeex/jitter.c	(working copy)
@@ -269,7 +269,7 @@
 
 
 /** Initialise jitter buffer */
-JitterBuffer *jitter_buffer_init(int step_size)
+EXPORT JitterBuffer *jitter_buffer_init(int step_size)
 {
    JitterBuffer *jitter = (JitterBuffer*)speex_alloc(sizeof(JitterBuffer));
    if (jitter)
@@ -294,7 +294,7 @@
 }
 
 /** Reset jitter buffer */
-void jitter_buffer_reset(JitterBuffer *jitter)
+EXPORT void jitter_buffer_reset(JitterBuffer *jitter)
 {
    int i;
    for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
@@ -325,7 +325,7 @@
 }
 
 /** Destroy jitter buffer */
-void jitter_buffer_destroy(JitterBuffer *jitter)
+EXPORT void jitter_buffer_destroy(JitterBuffer *jitter)
 {
    jitter_buffer_reset(jitter);
    speex_free(jitter);
@@ -365,7 +365,7 @@
 
 
 /** Put one packet into the jitter buffer */
-void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
+EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
 {
    int i,j;
    int late;
@@ -459,7 +459,7 @@
 }
 
 /** Get one packet from the jitter buffer */
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset)
+EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset)
 {
    int i;
    unsigned int j;
@@ -674,7 +674,7 @@
 
 }
 
-int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet)
+EXPORT int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet)
 {
    int i, j;
    for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
@@ -733,7 +733,7 @@
 }
 
 /* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
-int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
+EXPORT int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
 {
    /* If the programmer calls jitter_buffer_update_delay() directly, 
       automatically disable auto-adjustment */
@@ -743,12 +743,12 @@
 }
 
 /** Get pointer timestamp of jitter buffer */
-int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter)
+EXPORT int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter)
 {
    return jitter->pointer_timestamp;
 }
 
-void jitter_buffer_tick(JitterBuffer *jitter)
+EXPORT void jitter_buffer_tick(JitterBuffer *jitter)
 {
    /* Automatically-adjust the buffering delay if requested */
    if (jitter->auto_adjust)
@@ -764,7 +764,7 @@
    jitter->buffered = 0;
 }
 
-void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem)
+EXPORT void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem)
 {
    /* Automatically-adjust the buffering delay if requested */
    if (jitter->auto_adjust)
@@ -777,7 +777,7 @@
 
 
 /* Used like the ioctl function to control the jitter buffer parameters */
-int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
+EXPORT int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
 {
    int count, i;
    switch(request)
Index: libspeex/speex_callbacks.c
===================================================================
--- libspeex/speex_callbacks.c	(revision 14645)
+++ libspeex/speex_callbacks.c	(working copy)
@@ -40,7 +40,7 @@
 #include "arch.h"
 #include "os_support.h"
 
-int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
+EXPORT int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
 {
    int id;
    SpeexCallback *callback;
@@ -72,7 +72,7 @@
    return 0;
 }
 
-int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t m;
    m = speex_bits_unpack_unsigned(bits, 4);
@@ -80,7 +80,7 @@
    return 0;
 }
 
-int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t m;
    m = speex_bits_unpack_unsigned(bits, 4);
@@ -88,7 +88,7 @@
    return 0;
 }
 
-int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t m;
    m = speex_bits_unpack_unsigned(bits, 4);
@@ -97,7 +97,7 @@
 }
 
 #ifndef DISABLE_VBR
-int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t vbr;
    vbr = speex_bits_unpack_unsigned(bits, 1);
@@ -106,7 +106,7 @@
 }
 #endif /* #ifndef DISABLE_VBR */
 
-int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
 {
    spx_int32_t enh;
    enh = speex_bits_unpack_unsigned(bits, 1);
@@ -115,7 +115,7 @@
 }
 
 #ifndef DISABLE_VBR
-int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
 {
    float qual;
    qual = speex_bits_unpack_unsigned(bits, 4);
@@ -124,7 +124,7 @@
 }
 #endif /* #ifndef DISABLE_VBR */
 
-int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
 {
    unsigned char ch;
    ch = speex_bits_unpack_unsigned(bits, 8);
@@ -136,7 +136,7 @@
 
 
 /* Default handler for user callbacks: skip it */
-int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
+EXPORT int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
 {
    int req_size = speex_bits_unpack_unsigned(bits, 4);
    speex_bits_advance(bits, 5+8*req_size);
Index: libspeex/buffer.c
===================================================================
--- libspeex/buffer.c	(revision 14645)
+++ libspeex/buffer.c	(working copy)
@@ -48,7 +48,7 @@
    int   available;
 };
 
-SpeexBuffer *speex_buffer_init(int size)
+EXPORT SpeexBuffer *speex_buffer_init(int size)
 {
    SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer));
    st->data = speex_alloc(size);
@@ -59,13 +59,13 @@
    return st;
 }
 
-void speex_buffer_destroy(SpeexBuffer *st)
+EXPORT void speex_buffer_destroy(SpeexBuffer *st)
 {
    speex_free(st->data);
    speex_free(st);
 }
 
-int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
+EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
 {
    int end;
    int end1;
@@ -97,7 +97,7 @@
    return len;
 }
 
-int speex_buffer_writezeros(SpeexBuffer *st, int len)
+EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len)
 {
    /* This is almost the same as for speex_buffer_write() but using 
    SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */
@@ -129,7 +129,7 @@
    return len;
 }
 
-int speex_buffer_read(SpeexBuffer *st, void *_data, int len)
+EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len)
 {
    int end, end1;
    char *data = _data;
@@ -156,12 +156,12 @@
    return len;
 }
 
-int speex_buffer_get_available(SpeexBuffer *st)
+EXPORT int speex_buffer_get_available(SpeexBuffer *st)
 {
    return st->available;
 }
 
-int speex_buffer_resize(SpeexBuffer *st, int len)
+EXPORT int speex_buffer_resize(SpeexBuffer *st, int len)
 {
    int old_len = st->size;
    if (len > old_len)
Index: libspeex/preprocess.c
===================================================================
--- libspeex/preprocess.c	(revision 14645)
+++ libspeex/preprocess.c	(working copy)
@@ -392,7 +392,7 @@
 }
 
 #endif
-SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate)
+EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate)
 {
    int i;
    int N, N3, N4, M;
@@ -530,7 +530,7 @@
    return st;
 }
 
-void speex_preprocess_state_destroy(SpeexPreprocessState *st)
+EXPORT void speex_preprocess_state_destroy(SpeexPreprocessState *st)
 {
    speex_free(st->frame);
    speex_free(st->ft);
@@ -718,12 +718,12 @@
 
 void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *Yout, int len);
 
-int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo)
+EXPORT int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo)
 {
    return speex_preprocess_run(st, x);
 }
 
-int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
+EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
 {
    int i;
    int M;
@@ -1010,7 +1010,7 @@
    }
 }
 
-void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x)
+EXPORT void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x)
 {
    int i;
    int N = st->ps_size;
@@ -1045,7 +1045,7 @@
 }
 
 
-int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr)
+EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *ptr)
 {
    int i;
    SpeexPreprocessState *st;
Index: libspeex/speex_header.c
===================================================================
--- libspeex/speex_header.c	(revision 14645)
+++ libspeex/speex_header.c	(working copy)
@@ -83,7 +83,7 @@
 } SpeexHeader;
 */
 
-void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
+EXPORT void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const SpeexMode *m)
 {
    int i;
    const char *h="Speex   ";
@@ -118,7 +118,7 @@
    header->reserved2 = 0;
 }
 
-char *speex_header_to_packet(SpeexHeader *header, int *size)
+EXPORT char *speex_header_to_packet(SpeexHeader *header, int *size)
 {
    SpeexHeader *le_header;
    le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
@@ -142,7 +142,7 @@
    return (char *)le_header;
 }
 
-SpeexHeader *speex_packet_to_header(char *packet, int size)
+EXPORT SpeexHeader *speex_packet_to_header(char *packet, int size)
 {
    int i;
    SpeexHeader *le_header;
@@ -187,7 +187,7 @@
 
 }
 
-void speex_header_free(void *ptr)
+EXPORT void speex_header_free(void *ptr)
 {
    speex_free(ptr);
 }
-------------- next part --------------
--- libspeex.old	2008-03-29 03:05:36.000000000 +0100
+++ libspeex.new	2008-03-29 03:11:43.000000000 +0100
@@ -5,90 +5,8 @@
 D speex_nb_mode
 D speex_uwb_mode
 D speex_wb_mode
-R attenuation
-R cdbk_nb
-R cdbk_nb_high1
-R cdbk_nb_high2
-R cdbk_nb_low1
-R cdbk_nb_low2
-R exc_10_16_table
-R exc_10_32_table
-R exc_20_32_table
-R exc_5_256_table
-R exc_5_64_table
-R exc_8_128_table
-R exc_gain_quant_scal1
-R exc_gain_quant_scal1_bound
-R exc_gain_quant_scal3
-R exc_gain_quant_scal3_bound
-R gain_cdbk_lbr
-R gain_cdbk_nb
-R hexc_10_32_table
-R hexc_table
-R high_lsp_cdbk
-R high_lsp_cdbk2
-R lag_window
-R lpc_window
-R shift_filt
-R vbr_hb_thresh
-R vbr_nb_thresh
-R vbr_uhb_thresh
-T bw_lpc
-T compute_impulse_response
-T compute_rms
-T compute_rms16
-T filter_mem16
 T _fini
-T fir_mem16
-T forced_pitch_quant
-T forced_pitch_unquant
-T highpass
-T iir_mem16
 T _init
-T inner_prod
-T interp_pitch
-T lpc_to_lsp
-T lsp_enforce_margin
-T lsp_interpolate
-T lsp_quant_high
-T lsp_quant_lbr
-T lsp_quant_nb
-T lsp_to_lpc
-T lsp_unquant_high
-T lsp_unquant_lbr
-T lsp_unquant_nb
-T multicomb
-T nb_decode
-T nb_decoder_ctl
-T nb_decoder_destroy
-T nb_decoder_init
-T nb_encode
-T nb_encoder_ctl
-T nb_encoder_destroy
-T nb_encoder_init
-T nb_mode_query
-T noise_codebook_quant
-T noise_codebook_unquant
-T open_loop_nbest_pitch
-T pitch_search_3tap
-T pitch_unquant_3tap
-T pitch_xcorr
-T qmf_decomp
-T qmf_synth
-T residue_percep_zero16
-T sanitize_values32
-T sb_decode
-T sb_decoder_ctl
-T sb_decoder_destroy
-T sb_decoder_init
-T sb_encode
-T sb_encoder_ctl
-T sb_encoder_destroy
-T sb_encoder_init
-T scal_quant
-T scal_quant32
-T signal_div
-T signal_mul
 T speex_bits_advance
 T speex_bits_destroy
 T speex_bits_init
@@ -110,7 +28,6 @@
 T speex_bits_write_whole_bytes
 T speex_decode
 T speex_decode_int
-T speex_decode_native
 T speex_decoder_ctl
 T speex_decoder_destroy
 T speex_decoder_init
@@ -119,7 +36,6 @@
 T speex_default_user_handler
 T speex_encode
 T speex_encode_int
-T speex_encode_native
 T speex_encoder_ctl
 T speex_encoder_destroy
 T speex_encoder_init
@@ -144,17 +60,6 @@
 T speex_stereo_state_destroy
 T speex_stereo_state_init
 T speex_stereo_state_reset
-T split_cb_search_shape_sign
-T split_cb_shape_sign_unquant
-T _spx_autocorr
-T _spx_lpc
-T syn_percep_zero16
-T vbr_analysis
-T vbr_destroy
-T vbr_init
-T vq_nbest
-T vq_nbest_sign
-T wb_mode_query
 U acosf
 U calloc
 U exit
-------------- next part --------------
--- libspeexdsp.old	2008-03-29 03:05:30.000000000 +0100
+++ libspeexdsp.new	2008-03-29 03:00:36.000000000 +0100
@@ -1,13 +1,6 @@
 A __bss_start
 A _edata
 A _end
-T filterbank_compute_bank
-T filterbank_compute_bank32
-T filterbank_compute_psd
-T filterbank_compute_psd16
-T filterbank_destroy
-T filterbank_new
-T filterbank_psy_smooth
 T _fini
 T _init
 T jitter_buffer_ctl
@@ -21,14 +14,6 @@
 T jitter_buffer_reset
 T jitter_buffer_tick
 T jitter_buffer_update_delay
-T kiss_fft
-T kiss_fft_alloc
-T kiss_fftr
-T kiss_fftr2
-T kiss_fftr_alloc
-T kiss_fftri
-T kiss_fftri2
-T kiss_fft_stride
 T speex_buffer_destroy
 T speex_buffer_get_available
 T speex_buffer_init
@@ -40,7 +25,6 @@
 T speex_echo_cancellation
 T speex_echo_capture
 T speex_echo_ctl
-T speex_echo_get_residual
 T speex_echo_playback
 T speex_echo_state_destroy
 T speex_echo_state_init
@@ -73,16 +57,6 @@
 T speex_resampler_set_rate_frac
 T speex_resampler_skip_zeros
 T speex_resampler_strerror
-T spx_drft_backward
-T spx_drft_clear
-T spx_drft_forward
-T spx_drft_init
-T spx_fft
-T spx_fft_destroy
-T spx_fft_float
-T spx_fft_init
-T spx_ifft
-T spx_ifft_float
 U atan
 U calloc
 U cos


More information about the Speex-dev mailing list