From owner-freebsd-hackers Wed Apr 10 17: 6:23 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.dvart.com (mail.dvart.com [64.79.2.12]) by hub.freebsd.org (Postfix) with ESMTP id 3456737B405 for ; Wed, 10 Apr 2002 17:06:18 -0700 (PDT) Received: from mail.dvart.com (mail.dvart.com [64.79.2.12]) by mail.dvart.com (Postfix) with ESMTP id AACBFCD32; Wed, 10 Apr 2002 17:03:29 -0700 (PDT) Date: Wed, 10 Apr 2002 17:03:24 -0700 (PDT) From: bruno@tinkerbox.org X-Sender: bschwand@mail.dvart.com Reply-To: bruno@tinkerbox.org To: tlambert2@mindspring.com Cc: hackers@freebsd.org Subject: Re: problems with shared libraries In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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