-----Original Message-----
From: Jaroslav Kysela <[EMAIL PROTECTED]>
Date: Sat, 1 Dec 2001 19:33:55 +0100 (CET)
To: Kyle Centers <[EMAIL PROTECTED]>
Subject: Re: [Alsa-devel] bug in alsa-lib


> On Sun, 2 Dec 2001, Kyle Centers wrote:
> 
> > Hi!
> >
> > I've been working with an xmms plugin the last few days, and I seem to
> > have found a bug in libasound.so.
> >
> > Calling snd_pcm_open(...) in a program compiled as an executable
> > binary works fine (ie it returns no errors, and doesn't die). But if
> > compiled as part of a dynamic library, say an xmms output plugin, it
> > dies, with the following error messages:
> >
> > ALSA lib dlmisc.c:99:(snd_dlsym_verify) unable to verify version for
> > symbol and_config_hook_load
> >
> > ALSA lib conf.c:2287:(snd_config_hooks_call) symbol
> > snd_config_hook_load is not defined inside (null)
> >
> > I am still working on the second one, but I found a solution to the
> > first one.
> >
> > The problem, is in dlmisc.c at line 2278:
> >  h = snd_dlopen(lib, RTLD_NOW);
> >
> > I'm not really sure why, but *lib is null at this point. The result is
> > that when dlopen is called, inside snd_dlopen, the filename is null,
> > which dlopen takes to mean the main program (according to the man
> > page). With a standard binary executable, that's fine,
> > because-actually, I'm not sure why that's ok. But I would venture to
> > guess it has to do with libasound getting loaded with the binary. But
> > when compiling a dynamic library, the main program is something else -
> > in this case xmms, which knows nothing about libasound (all the alsa
> > stuff in inside the plugin).
> >
> > I did managed to fix the problem, but my solution is a hack. in the
> > call to snd_dlopen, I replaced lib with "/usr/lib/libasound.so",
> > explicitly telling it to load the asound library. Now, the error is
> > gone (the first one. I havent' gotten to the second, although I
> > suspect it is similar). Anyone know how to fix ths properly?
> 
> Yes, the xmms engine should add the RTLD_GLOBAL flag to dlopen() call for
> external plugins:
> 
> /* If the following bit is set in the MODE argument to `dlopen',
>    the symbols of the loaded object and its dependencies are made
>    visible as if the object were linked directly into the program.  */
> #define RTLD_GLOBAL     0x00100
> 

You're right. I added flag to xmms, and the plugin works perfecty now. With your 
permission (since you made the suggestion), I'll send an email off to the xmms team 
about it.

> I'm sorry for this, but it really doesn't make any sense to create

Sorry? no need to say sorry, you're completely right.

> another instance of dynamic library when symbol can be already
> resolved using existing instances.
> 
>                                               Jaroslav
> 
> -----
> Jaroslav Kysela <[EMAIL PROTECTED]>
> SuSE Linux    http://www.suse.com
> ALSA Project  http://www.alsa-project.org
> 
> 

-- 

_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


1 cent a minute calls anywhere in the U.S.!

http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com



_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to