[Mono-list] Mono and MAC OS X?

Paolo Molaro lupus@ximian.com
Wed, 26 Mar 2003 15:40:47 +0100

On 03/25/03 Joe Shaw wrote:
> On Tue, 2003-03-25 at 11:08, Paolo Molaro wrote:
> > *) dllimport: we currently use GModule and the code in glib doesn't
> > handle shared libraries. Someone should investigate about using dlopen
> > in GModule or adding a wrapper in mono
> The main problem here is that mono takes for granted heavily that in ELF
> shared libraries and loadable modules are the same thing.  In Mach-O
> this isn't the case, so you can't simply call dlopen() on a shared
> library (-shared passed to the linker).  The module has to be built with
> -bundle.

It's not mono per se, it's the CLR spec. We need to be able to load
symbols from shared libraries and GModule instead loads only bundles
(they happen to be the same thing as shared libs on most systems).

> Also, on OS X the dlopen() calls are compatibility wrappers around the
> native dyld implementation, so using that instead of the dyld
> implementation in glib2 won't help.

A quick google search got this:
  dlcompat for Darwin
  This is dlcompat, a small library that emulates the dlopen()
  interface on top of Darwin's dyld API.
  Unlike finks older dlcompat, this dlcompat allows loading a ".dylib" 
  library (as long as the RTLD_LOCAL flag isn't passed to dlopen()). It can 
  be configured to yield a warning when trying to close it (dynamic 
  libraries cannot be unloaded).

The unload feature is not important, so it's a limitation we don't care
about. The RTLD_LOCAL issue is not a show-stopper either.
It would be better if glib had this feature, but:
*) I doubt it would be accepted (doesn't hurt to ask, though)
*) it would take many months for it to get deployed, anyway

So we need someone to track down this dlcompat library and add support
in the mono runtime to use it instead of gmodule. Any volunteers?

lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better