lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, 3 Apr 2007 14:13:31 -0700
Sam Roberts <sroberts@bycast.com> wrote:

> On Tue, Apr 03, 2007 at 05:48:11PM -0300, Luiz Henrique de Figueiredo
> wrote:
>
> If my memory hasn't failed, -dynamiclib creates things that can't be
> loaded with NSBundle (the dyld-based stuff in loadlib.c, for example).
> 
> The distinction between them in OS X's Mach-O binary format, as far
> as I could tell, is that bundles are for libraries loaded
> programmatically at runtime ("plugins", lua modules would fit in this
> category), and that dynamic libs are linked against an application
> (dynamically linked, of course).  dlopen()/ELF makes no such
> distinction, so maybe dlopen() on OS X is smoothing over the
> difference, to help portability.

You're right, as far as I can recall, both dlcompat (and libdl in
newer MacOSX releases) allow loading shared object code linked with
"-dynamiclib", but it cannot be safely unloaded afterwards by means of
dlclose() or equivalent calls to dyld functions. Shared object code
created with "-bundle" *can* be effectively unloaded. Unloading of
object code usually is not very important, but it may be desired (and
even imprescindible!) for long-running applications, or in applications
which can can upgrade their code on the fly while running.

Cheers,


P.S. Please correct me if I'm mistaken, it's been a long time since I
stopped using MacOS X regularly...

-- 
SIGIRO -- too much irony (core dumped)

Attachment: signature.asc
Description: PGP signature