Dynamic Libraries on MacOS X

Simon Marlow simonmar@microsoft.com
Mon, 10 Jun 2002 12:03:48 +0100

> Possible Solution:
> Frameworks. A "Framework" on MacOS X is a directory that=20
> contains a dynamic library plus associated resources and=20
> header files. There is an extra compiler/linker option for=20
> linking to a framework. The big advantage is that the place=20
> they are supposed to be installed in is accessible from the=20
> user interface.
> I've created a framework called "HaskellSupport.framework",=20
> and I've made ghc link to that.

It sounds like frameworks are similar in concept to GHC's packages.
It's usually a good idea to comply with whatever is the approved way of
doing things on a given platform, so I think this sounds like a
reasonable solution.

> Disadvantage:
> Problems with GHCi (yes, I've almost got it to work!) -=20
> "-framework HaskellSupport" is in the extra_ld_opts field of=20
> the RTS package, so GHCi doesn't know that it has to load the=20
> libraries.

That sounds fine... as long as HaskellSupport doesn't contain any static
libraries, right?

> Related Problem:
> Sooner or later, GHC for MacOS X should support Apple's=20
> Frameworks anyway, as almost all functionality beyond the=20
> standard C library is packaged in frameworks. I don't know=20
> yet how much work that would be for me, and I fear that the=20
> ghc gurus would dislike too much platform-specific code for=20
> Apple's non-standard features... Here's what I'd like to do:

I don't object at all to adding MacOS X specific code for frameworks, as
long as there's someone around to maintain it!

> *) add two command line options that get passed on to the=20
> linker (-framework for linking with a framework and -F for=20
> specifying framework search paths)
> *) add corresponding entries to package.conf

You mean add a new package for each framework?  That's what I would
suggest, if it is at all possible.  If that's the case, then is the
-framework option needed at all, since you can use -package instead?

> *) add code for GHCi to load frameworks.

Same here: if a framework is really just a collection of libraries and a
search path, then converting frameworks into packages will mean that
GHCi can load them as normal.