unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: Hans Aberg <haberg@math.su.se>
Cc: bug-guile@gnu.org
Subject: Re: Mac OS X .dylib
Date: Sat, 30 Jan 2010 13:39:39 -0500	[thread overview]
Message-ID: <B35252FC-EEB1-414C-A0C9-9B983335E065@raeburn.org> (raw)
In-Reply-To: <DE114180-13F6-498C-9E48-9407E5CFBBA7@math.su.se>

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




  parent reply	other threads:[~2010-01-30 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30 14:41 Mac OS X .dylib Hans Aberg
2010-01-30 18:37 ` Ludovic Courtès
2010-01-30 19:52   ` Hans Aberg
2010-01-30 18:39 ` Ken Raeburn [this message]
2010-01-30 20:03   ` Hans Aberg
2010-01-30 19:30 ` Andy Wingo
2010-01-30 22:10   ` Hans Aberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B35252FC-EEB1-414C-A0C9-9B983335E065@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=bug-guile@gnu.org \
    --cc=haberg@math.su.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).