[alsa-devel] [Closed]ALSA calls don't work from a shared library

Olivier Guillion - Myriad olivier at myriad-online.com
Thu Aug 25 17:31:42 CEST 2011


I could finally make it work:
- The library corruption problem was due to a faulty symbolic link to an 
outdated library.
- I could fix the linker problem by including "/usr/lib/libasound.so.2" in my 
link options
- I still got an error sometimes on "snd_async_add_pcm_handler" but I replaced 
it by a second thread that fills the pcm buffer when needed.
- The only remaining problem is "snd_device_name_hints" that crashes 
inexplicably one out of 5, but I'm working on it.

Thanks for your help!


I wrote:
> Thank you very much for your answer!
> I agree, it's definitely a link problem. 
> If my main module sends the addresses of the ALSA functions to the shared 
> library, the test works.
> It then means that the shared library by itself doesn't know the right location
> of the functions, and that there is a problem during the run-time link.
> It has then nothing to do with ALSA, but in my way of managing libraries. :) I
> have 15 years of experience in C, but only a couple of months on Linux, and
> sometimes I'm a bit lost.
> To make ALSA work in my projects (I'm using Code:Blocks), I added to the link
> section all the .so libraries I found in /usr/lib/alsa-lib. Apparently it worked
> for stand-alone programs, but not for shared libraries.
> Could you please tell me what I should add to my project (I'm using 
> Code:Blocks) to make my programs use the current ALSA shared library in the
> system? I tried to build the static lib (./configure --enable-makeshared=no --
> enable-static=yes) then the shared lib (./configure --enable-makeshared=no --
> enable-static=yes) but it seems to have corrupted my system. My already compiled
> old programs don't work anymore, saying that "snd_async_add_pcm_handler" is not
> implemented.
> Sorry if my request is out of the topic of this mailing-list. Please do not
> hesitate to tell me if so.

More information about the Alsa-devel mailing list