Hi,
I am trying to build a custom hook library. The minimal hook is:
#include <alsa/asoundlib.h>
int _snd_pcm_hook_audio_status_install(snd_pcm_t *pcm, snd_config_t *conf) { return 0; } SND_DLSYM_BUILD_VERSION(_snd_pcm_hook_audio_status_install, SND_CONFIG_DLSYM_VERSION_HOOK);
I compile this as a shared library:
$(CC) -fPIC -lasound -shared -Wl,-soname,lib$(NAME).so $^ -o $@
If I try to load this library using aplay I get the following error:
dlopen failed: Error relocating /usr/lib/alsa-lib/libaudiostatus.so: snd_dlsym_start: symbol not found
This is the output of the preprocessor:
int _snd_pcm_hook_audio_status_install(snd_pcm_t *pcm, snd_config_t *conf) { return 0; } static struct snd_dlsym_link _snd_dlsym__snd_pcm_hook_audio_status_install_dlsym_config_hook_001; void _snd_dlsym_constructor__snd_pcm_hook_audio_status_install_dlsym_conf ig_hook_001 (void) __attribute__ ((constructor)); void _snd_dlsym_constructor__snd_pcm_hook_audio_status_install_dlsym_conf ig_hook_001 (void) { _snd_dlsym__snd_pcm_hook_audio_status_install_dlsym_config_hook _001.next = snd_dlsym_start; _snd_dlsym__snd_pcm_hook_audio_status_install_dlsym_config_hook _001.dlsym_name = "_snd_pcm_hook_audio_status_install"; _snd_dlsym__snd_pcm_hook_audio_status_install_dlsym_config_hook _001.dlsym_ptr = (void *)&_snd_pcm_hook_audio_status_install; snd_dlsym_start = &_snd_dlsym__snd_pcm_hook_audio_status_install_dlsym_config_hook_001 ; };
What do I miss?
Best regards Jörg Krause