Date: Wed, 10 Apr 2002 17:22:17 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: bruno@tinkerbox.org Cc: hackers@freebsd.org Subject: Re: problems with shared libraries Message-ID: <3CB4D739.3F0E12D8@mindspring.com> References: <Pine.BSF.4.21.0204101538000.55519-100000@mail.dvart.com>
next in thread | previous in thread | raw e-mail | index | archive | help
bruno@tinkerbox.org wrote:
> I tried that and resolved all entry points. It is neither dlopen() nor
> dlsym() that fail, it is when I try using that entry point that it fails.
>
> code snippet:
>
> if ((phandle = dlopen(filename, RTLD_LAZY)) == NULL) {
Change this to "RTLD_NOW".
> /* failed to load input plug */
> event_printf(EVENT_LOG, 0, "dlopen: %s.", dlerror());
> return(-1);
> }
Add:
else printf( "dlopen failed: %s\n", dlerror());
> if ((gpi = dlsym(phandle, "get_iplugin_info")) != NULL) {
> /* initialise as an input plugin */
> fails here----> ip = (InputPlugin *) gpi();
This can only happen if the "get_iplugin_info" function in your
module references symbols defined in a shared object not loaded
before it was loaded.
Use "nm foo.So" for the shared object for the module "foo.so" to
see what external suymbols are referenced by the module.
> the backtrace shows that calling get_iplugin_info() leads to a
> g_strdup_printf() that later fails in vfprintf() from libc_r.so.4
>
> so it fails in a call to glib. You'll tell me there is a bug in the
> plugin, but I know there is not, this plugin (shared lib) works perfectly
> with xmms.
Ah. You are using glib. That's implicitly broken. Don't use
glib, and your problem will go away.
> Which leads me to thinking there is a problem between differing libs, or
> something. Any other ideas ?
Create a module "wrapper.so" that dlopen's glib.so.xxx, and *then*
dlopen's your module, and then reflects the interfaces down.
Alternately, don't use glib: it's intrinsically broken, by design.
-- Terry
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CB4D739.3F0E12D8>
