NSInstallLinkEditErrorHandlers() does not work in Tiger.
NSInstallLinkEditErrorHandlers() does not work in Tiger.
- Subject: NSInstallLinkEditErrorHandlers() does not work in Tiger.
- From: Leon Bottou <email@hidden>
- Date: Wed, 8 Jun 2005 17:04:44 -0400
- Resent-date: Wed, 8 Jun 2005 17:13:36 -0400
- Resent-date: Wed, 8 Jun 2005 17:12:23 -0400
- Resent-from: Leon Bottou <email@hidden>
- Resent-from: Leon Bottou <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: email@hidden
- Resent-to: email@hidden
In Tiger, NSInstallLinkEditErrorHandlers() does not work anymore.
Example:
----- begin foo.c
extern int bar(int);
int foo(int x) { return bar(x); }
----- end foo.c
----- begin bar.c
int bar(int x) { return x*x; }
----- end bar.c
----- begin load.c
#include <stdlib.h>
#include <stdio.h>
#include <mach-o/dyld.h>
static NSLinkEditErrorHandlers handlers;
static void load(const char *bundle)
{
NSModule module;
NSObjectFileImage image;
printf("Loading '%s'\n", bundle);
if (NSCreateObjectFileImageFromFile(bundle,&image)
== NSObjectFileImageSuccess)
if (NSLinkModule(image,bundle,NSLINKMODULE_OPTION_BINDNOW))
{
printf("Loaded '%s'\n", bundle);
return;
}
printf("Problem loading %s\n", bundle);
exit(10);
}
static void undefined(const char *sname)
{
printf("Entering undefined handler '%s'\n", sname);
load("bar.bundle");
printf("Leaving undefined handler '%s'\n", sname);
}
int main(void)
{
handlers.undefined = undefined;
NSInstallLinkEditErrorHandlers(&handlers);
load("foo.bundle");
}
----- end load.c
Compile with:
$ cc load.c -o load
$ cc -bundle -flat_namespace -undefined suppress bar.c -o bar.bundle
$ cc -bundle -flat_namespace -undefined suppress foo.c -o foo.bundle
UNDER PANTHER:
$ ./load
Loading 'foo.bundle'
Entering undefined handler '_bar'
Loading 'bar.bundle'
Loaded 'bar.bundle'
Leaving undefined handler '_bar'
Loaded 'foo.bundle'
UNDER TIGER:
$ ./load
Loading 'foo.bundle'
dyld: NSLinkModule() error
dyld: Symbol not found: _bar
Referenced from: foo.bundle
Expected in: flat namespace
Trace/BPT trap
CONCLUSION:
When running on Tiger,
the undefined handler was not called.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden