Date: Wed, 10 Apr 2002 17:03:24 -0700 (PDT) From: bruno@tinkerbox.org To: tlambert2@mindspring.com Cc: hackers@freebsd.org Subject: Re: problems with shared libraries Message-ID: <Pine.BSF.4.21.0204101538000.55519-100000@mail.dvart.com> In-Reply-To: <Pine.BSF.4.21.0204101541500.1174-100000@router.bschwand.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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) { /* failed to load input plug */ event_printf(EVENT_LOG, 0, "dlopen: %s.", dlerror()); return(-1); } if ((gpi = dlsym(phandle, "get_iplugin_info")) != NULL) { /* initialise as an input plugin */ fails here----> ip = (InputPlugin *) gpi(); ip->handle = phandle; ip->filename = (char *)strdup(filename); if (ip->init) ip->init(); event_printf(EVENT_LOG, 0, "pluginterface_load: Initialised %s", ip->description); ipl_add(ip); return 1; } 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. The code to load and init the plugin was lifted from xmms actually. Which leads me to thinking there is a problem between differing libs, or something. Any other ideas ? bruno > bruno@tinkerbox.org wrote: > > Well, if I do link with -export-dynamic, I can not even make the first > > call to anything in the plugin, it segfaults immediately on some > > g_vsprintf_XXX function (that seems to come from glib). > > > > What is going on ? I link the program with glib and all necessary libs. > > > > If anybody has some insight on this, please let me know... > > Nothing a tiny bit of instrumentation and a change in the way > you open it couldn't fix. > > Set RTLD_NOW rather than RTLD_LAZY for testing. When the dlopen() > fails, call dlerror() to retrieve the error message; it will tell > you exactly what is failing. > > -- 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?Pine.BSF.4.21.0204101538000.55519-100000>