discuss-gnustep
[Top][All Lists]
Advanced

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

Re: New method to load user bundles


From: Alexander Malmberg
Subject: Re: New method to load user bundles
Date: Tue, 03 Jun 2003 16:30:23 +0200

Jeff Teunissen wrote:
> 
> LD_PRELOAD can't replace code inside a program, it can only replace one
> shared library with another.

This is wrong. LD_PRELOAD tells the dynamic linker to load some shared
objects, and is equivalent to the code loading part of NSBundle. Eg.:

LD_PRELOAD=/opt/gstep/apps/Camaelon/Camaelon.themeEngine/ix86/linux-gnu/gnu-gnu-gnu/Camaelon
~/gstep/Terminal/Terminal.app/ix86/linux-gnu/gnu-gnu-gnu/Terminal

will run Terminal with the Camaelon theme (with a few glitches since
Camaelon isn't expecting to be loaded this way), and there's nothing the
app can do about it.

> GSAppKitUserBundles is more powerful than LD_*, because it lets you modify
> the app itself, not just the libraries it is linked with.
>
> It's well-known that if you use shared libraries, you can't trust their
> code. It is also well-known that if you use bundles, you can't even trust
> YOUR code.

Normally, neither shared libraries nor bundles modify code inside your
app, although both could. You may be thinking of categories and changing
the dispatch tables to not point to your implementations, but this is
done automatically by all shared objects that contain objective-c
classes or categories. There is no magic in bundle loading that gives
their code more capabilities than the code in any other shared object.

- Alexander Malmberg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]