From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.lisp.guile.bugs Subject: Re: Mac OS X .dylib Date: Sat, 30 Jan 2010 13:39:39 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1264876965 2103 80.91.229.12 (30 Jan 2010 18:42:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Jan 2010 18:42:45 +0000 (UTC) Cc: bug-guile@gnu.org To: Hans Aberg Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Jan 30 19:42:42 2010 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NbIGT-0003YQ-UJ for guile-bugs@m.gmane.org; Sat, 30 Jan 2010 19:42:33 +0100 Original-Received: from localhost ([127.0.0.1]:57360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NbIGM-0006Dj-12 for guile-bugs@m.gmane.org; Sat, 30 Jan 2010 13:41:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NbIGG-0006D0-Of for bug-guile@gnu.org; Sat, 30 Jan 2010 13:41:36 -0500 Original-Received: from [199.232.76.173] (port=50718 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NbIGG-0006Cp-9B for bug-guile@gnu.org; Sat, 30 Jan 2010 13:41:36 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NbIGB-0005Lh-M1 for bug-guile@gnu.org; Sat, 30 Jan 2010 13:41:35 -0500 Original-Received: from mx20.gnu.org ([199.232.41.8]:1365) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NbIG7-0005IL-8O for bug-guile@gnu.org; Sat, 30 Jan 2010 13:41:31 -0500 Original-Received: from splat.raeburn.org ([69.25.196.39] helo=raeburn.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NbIF8-0003xj-Vr for bug-guile@gnu.org; Sat, 30 Jan 2010 13:40:34 -0500 Original-Received: from squish.raeburn.org (squish.raeburn.org [10.0.0.172]) by raeburn.org (8.14.3/8.14.1) with ESMTP id o0UIddSL009373; Sat, 30 Jan 2010 13:39:39 -0500 (EST) In-Reply-To: X-Mailer: Apple Mail (2.936) X-detected-operating-system: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4478 Archived-At: On Jan 30, 2010, at 09:41, Hans Aberg wrote: > [I'm not on this list, so please cc me.] > > It seems guile-1.8.7 does not admit dynamic library file name > extensions .dylib, but only .so, on Mac OS X (tried 10.5.8. PPC G4), > despite the manual saying guile should adapt to local standards. The > example in the manual sec. 4.2.1 works fine with > gcc -dynamiclib -lguile -o libguile-bessel.so bessel.c > but not if changed to libguile-bessel.dylib, giving the error within > guile: > standard input:2:1: file: "libguile-bessel", message: "file not > found" The Mac OS X situation is a bit more complicated than on "normal" ELF- based UNIX systems; shared libraries and dynamically loadable objects are not the same thing. It's easy to assume they're equivalent when working mostly on ELF or Windows systems where .so or .dll files work for both, but it's not always true. GNU libtool even has options for creating loadable modules as distinct from regular shared libraries. See for example http://www.finkproject.org/doc/porting/porting.en.html#shared.lib-and-mod for one brief discussion of shared libraries versus "bundles" on the Mac, and how the ".so" suffix is often used for loadable objects by convention in ported UNIX software (not just in fink, but in the OS: / usr/lib/pam/*.so, /usr/lib/sasl2/*.so), though I see a lot of ".bundle" names on my system too. Further confusing the matter: * The term "bundle" seems to be used in Apple documentation both for a particular type of file generated by the linker for loadable objects -- the linker has different flags for them vs shared libraries -- and a directory structure used for distributing a collection of files as an application, framework, or plugin. * The modern dlopen implementation on the Mac (it wasn't there at all in 10.0) seems capable of loading both "bundles" (the file version I think) and regular Mac shared libraries. In 10.4, dlclose() couldn't unload a dynamic library but could unload a bundle; in 10.5, it can unload both. So it's unclear how relevant the distinction between "loadable objects" and "shared libraries" is any more, at least if you're targeting 10.5 or 10.6 as your minimum required OS version. One distinction I haven't (yet) seen mentioned as having gone away is that bundles can reference symbols from the main application, but dynamic libraries cannot. See also http://lists.apple.com/archives/darwin-dev/2008/Dec/msg00045.html ... http://developer.apple.com/Mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html describes the Mach-O file types, and says ".bundle" is the conventional suffix for plugins. So, in short, one could argue that looking only for ".so" for dynamically loadable objects *is* conforming to (one set of) standards for the Mac, annoying though it may be. > On Mac OS X, it should probably look for .dylib first, and > perhaps .so for backwards compatibility. I think perhaps it should try without a suffix (in case the application code specifies it), then both of these and maybe also ".bundle", though I don't have a strong sense which order they should be tried in. Ken