[speex-dev] does installed lib support _int()s ?

Malcolm Baldridge
Fri, 06 Aug 2004 15:02:04 -0000

> Assuming one prefers to use the speex_encode_int() and
> speex_decode_int() when available, but fallback to speex_encode()
> and speex_decode() if an older version if the lib is installed,
> how does one best make the determination?

Well, for compile-time, I'd think that an #ifdef would do the trick.

The only way you could do it at RUNTIME is if you perform a dlopen() on the
speex library instead having it shared-linked, since the runtime ld.so will
fail to run your binary if it's linked against an old speex library without
the speex_XXXXX_int() symbols.  You'd open the .so file with RTLD_LAZY mode.

Of course, you'll need to figure out where the speex library is within your
program.  You'll be linking against libdl rather than libspeex, and
performing  a dlopen() and dlsym() for the various entry points.

You could always walk the /etc/ld.so.conf file for pathnames where to look
for the libspeex.so files.

=MB